QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#661109 | #9442. Music Game | Forever_Young# | AC ✓ | 103ms | 6260kb | C++14 | 694b | 2024-10-20 14:44:48 | 2024-10-20 14:44:53 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int mo=998244353;
int pow(int x,int y){
int res=1;
while (y){
if (y&1) res=1ll*res*x%mo;
x=1ll*x*x%mo;
y=y/2;
}
return res;
}
int inv(int x){
return pow(x,mo-2);
}
struct node{
int t,a,b;
bool operator<(const node& v) const{
return 1ll*t*b*(v.b-v.a)<1ll*v.t*v.b*(b-a);
}
};
int n;
node g[200005];
int main(){
scanf("%d",&n);
for (int i=1;i<=n;i++) scanf("%d%d%d",&g[i].t,&g[i].a,&g[i].b);
sort(g+1,g+n+1);
int ans=0;
for (int i=1;i<=n;i++){
ans=1ll*(ans+g[i].t)*g[i].b%mo*inv(g[i].a)%mo;
}
printf("%d\n",ans);
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
input:
2 3 3 5 2 4 7
output:
831870305
result:
ok "831870305"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
5 2 5 9 6 4 7 1 9 14 17 8 13 10 4 11
output:
914017655
result:
ok "914017655"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
8 6 2 8 3 1 8 5 30 71 7 9 58 6 4 7 6 9 25 2 8 67 6 6 55
output:
923892723
result:
ok "923892723"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
2 2 2 3 1 5 6
output:
399297746
result:
ok "399297746"
Test #5:
score: 0
Accepted
time: 2ms
memory: 3940kb
input:
6057 598846 477861 477861 355457 471360 471360 52553 53505 53505 910434 715394 957062 829770 396343 396343 388604 220815 628584 697515 339144 976739 134698 713562 713562 103516 548592 976096 328488 131879 979654 360558 458803 458803 609012 481090 852195 207954 434215 434215 74492 313219 453266 11312...
output:
209793398
result:
ok "209793398"
Test #6:
score: 0
Accepted
time: 19ms
memory: 4552kb
input:
60325 249263 702771 806647 825858 894224 894224 954851 857512 857512 682622 271953 271953 37366 859065 859065 455311 280629 280629 139413 628817 628817 289777 745827 889101 941889 44512 44512 261500 956143 956143 683456 849819 849819 380838 640198 640198 458670 425331 923542 724423 786203 786203 886...
output:
401590376
result:
ok "401590376"
Test #7:
score: 0
Accepted
time: 31ms
memory: 4896kb
input:
92527 45889 267333 275737 192999 354289 476002 466286 564920 564920 462999 71086 71086 812092 291868 308621 691602 7181 658070 932827 698613 698613 421190 429765 957938 835947 301778 301778 37833 286079 519204 310540 190221 438559 373458 283897 832299 252879 196799 846520 579418 630867 630867 549650...
output:
96242233
result:
ok "96242233"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
1 1 1 1
output:
1
result:
ok "1"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
999 1000000 396835 396835 1000000 93318 93318 1000000 41845 41845 1000000 124345 124345 1000000 395818 395818 1000000 11451 11451 1000000 402449 402449 1000000 436982 436982 1000000 700651 700651 1000000 173577 173577 1000000 644506 644506 1000000 763617 763617 1000000 211774 211774 1000000 479674 4...
output:
0
result:
ok "0"
Test #10:
score: 0
Accepted
time: 67ms
memory: 6152kb
input:
200000 948048 740805 903396 889008 78074 240019 857255 92653 191934 686969 251362 629895 580967 284696 798454 60169 102579 640774 850842 23762 270476 891313 228165 875144 623672 304920 922045 626460 687951 775366 381072 321747 530692 851148 232720 429493 664140 21870 476139 505024 285393 677447 7562...
output:
951930337
result:
ok "951930337"
Test #11:
score: 0
Accepted
time: 70ms
memory: 6260kb
input:
200000 990290 993955 998787 998742 990565 994467 993457 992286 993572 992536 992949 999000 992916 992475 995754 990029 990571 992048 999876 996425 998569 994697 994917 999583 998035 997059 997842 995130 994529 998964 995030 992049 993738 993099 992441 992800 999621 993259 999184 995938 993143 996572...
output:
989457897
result:
ok "989457897"
Test #12:
score: 0
Accepted
time: 94ms
memory: 6148kb
input:
200000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...
output:
351129400
result:
ok "351129400"
Test #13:
score: 0
Accepted
time: 86ms
memory: 6164kb
input:
195083 290681 571099 571099 177284 363632 363632 691542 936946 936946 722846 119068 119068 900300 136457 136457 721155 930996 930996 449146 710070 710070 479035 82216 82216 716421 319684 319684 713173 167630 167630 653187 596473 596473 615010 630988 630988 700234 138349 138349 176490 167003 167003 7...
output:
635680574
result:
ok "635680574"
Test #14:
score: 0
Accepted
time: 88ms
memory: 6116kb
input:
197450 929644 489307 489307 10495 6131 6131 872006 342249 342249 125201 487534 487534 156625 774564 774564 669956 789711 789711 523492 398527 398527 773503 342660 342660 811022 323677 323677 756960 761745 761745 976896 349932 349932 793816 993072 993072 26825 644462 644462 151070 743736 743736 77713...
output:
986109630
result:
ok "986109630"
Test #15:
score: 0
Accepted
time: 91ms
memory: 5996kb
input:
192457 122520 158846 870915 122520 158846 870915 61260 158846 870915 845388 158846 870915 808632 158846 870915 12252 158846 870915 159276 158846 870915 453324 158846 870915 379812 158846 870915 857640 158846 870915 698364 158846 870915 894396 158846 870915 833136 158846 870915 747372 158846 870915 5...
output:
530970138
result:
ok "530970138"
Test #16:
score: 0
Accepted
time: 88ms
memory: 6016kb
input:
194473 342087 147092 606618 342087 147092 606618 342087 147092 606618 342087 147092 606618 684174 147092 606618 342087 147092 606618 342087 147092 606618 342087 147092 606618 684174 147092 606618 342087 147092 606618 684174 147092 606618 684174 147092 606618 342087 147092 606618 684174 147092 606618...
output:
910642136
result:
ok "910642136"
Test #17:
score: 0
Accepted
time: 79ms
memory: 5976kb
input:
190538 279917 504887 716522 839751 504887 716522 559834 504887 716522 581507 358674 864110 279917 504887 716522 849999 691595 904571 559834 504887 716522 849999 691595 904571 279917 504887 716522 839751 504887 716522 283333 691595 904571 849999 691595 904571 566666 691595 904571 566666 691595 904571...
output:
634731960
result:
ok "634731960"
Test #18:
score: 0
Accepted
time: 91ms
memory: 6092kb
input:
193971 300146 485898 645026 745036 899463 988198 709436 485898 645026 745036 899463 988198 272860 485898 645026 245574 485898 645026 927724 485898 645026 709436 485898 645026 979605 743088 822090 745036 899463 988198 745036 899463 988198 600292 485898 645026 736722 485898 645026 745036 899463 988198...
output:
611083530
result:
ok "611083530"
Test #19:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
7 839755 251655 600352 907174 575283 592441 972090 436864 717421 862892 233348 985637 327472 345992 766540 942481 572923 934818 154163 355358 704351
output:
817517885
result:
ok "817517885"
Test #20:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
5 391311 358110 976799 126443 271046 435460 441811 489635 642585 261797 706786 832800 636453 25236 40507
output:
811535161
result:
ok "811535161"
Test #21:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
5 236578 624835 880643 206088 257086 867109 416275 293541 925793 741592 451446 755954 411803 115719 436489
output:
122280364
result:
ok "122280364"
Test #22:
score: 0
Accepted
time: 2ms
memory: 3960kb
input:
6461 955074 137340 747295 602447 308743 860169 988699 44549 562333 96141 195266 321617 722429 124841 463907 981659 116582 949699 788086 26519 603682 729265 92288 366722 678823 595820 988775 163868 163967 398267 804437 27127 496871 125292 115631 964883 466538 292763 356032 386650 336824 709888 147073...
output:
262778977
result:
ok "262778977"
Test #23:
score: 0
Accepted
time: 2ms
memory: 3952kb
input:
3067 254703 789066 833844 772366 588208 818212 719566 221999 293678 888949 11459 541735 171855 186032 935546 519590 276645 704406 651830 352888 781420 32110 269177 828906 587215 540839 820950 466439 98220 411319 403783 272651 658641 415054 374299 851586 409564 238690 746846 927633 280121 990423 3681...
output:
266363938
result:
ok "266363938"
Test #24:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
2106 440660 281403 461784 259540 206107 492716 146395 90150 806224 180195 197235 900197 409832 234325 841996 429517 486551 607945 201705 258683 693868 650531 290778 990147 880545 11927 399441 740483 337063 974536 126155 447720 479102 805681 497989 807257 707809 21611 124364 938103 52487 450096 60767...
output:
435621952
result:
ok "435621952"
Test #25:
score: 0
Accepted
time: 36ms
memory: 5992kb
input:
98082 713776 913559 987961 832721 727894 950761 746129 383736 982714 370906 129760 363629 292851 411568 654238 543213 292298 835394 207979 189381 712673 432427 688466 705561 165139 150707 357799 831809 860844 936835 22882 57534 741348 603066 97280 487115 878918 445070 602854 83012 446051 647403 9990...
output:
186707399
result:
ok "186707399"
Test #26:
score: 0
Accepted
time: 27ms
memory: 4660kb
input:
72065 702578 745750 984973 577808 564754 666753 72277 16523 638395 39612 479882 549422 69934 540794 607595 434967 114790 834986 906403 152109 843301 807346 480594 512927 593436 470839 992874 903113 630474 988079 317955 197860 668046 288535 436422 657639 280256 303434 661617 16660 200991 286316 43787...
output:
887355279
result:
ok "887355279"
Test #27:
score: 0
Accepted
time: 66ms
memory: 5928kb
input:
177741 944794 480739 801483 946686 571135 900539 455887 365558 534033 771232 353491 780730 834029 115564 165928 457143 361874 635442 280239 142906 461171 7696 92721 902690 429307 315437 345853 80330 177888 724039 609854 793408 798396 375921 499302 865631 413630 157733 666787 392594 92209 304353 9507...
output:
245318058
result:
ok "245318058"
Test #28:
score: 0
Accepted
time: 17ms
memory: 4388kb
input:
55337 21019 1467 645414 161717 100051 182055 709037 353664 684793 576154 99188 668240 714501 198814 233361 95079 27620 902806 473422 417984 619312 804444 3513 18319 828521 243699 923087 638866 428052 809038 675914 936707 986891 799067 526980 943737 646049 380918 891222 439011 691352 935681 537909 49...
output:
377099624
result:
ok "377099624"
Test #29:
score: 0
Accepted
time: 39ms
memory: 5252kb
input:
119349 943399 72025 241677 360816 134348 470825 655737 420197 853612 340145 76732 486698 954589 464433 513680 314039 155666 684710 445812 620444 856302 858496 63064 665222 911033 486495 670760 857940 276959 799244 279468 147142 444277 890270 859948 946835 764824 67771 383265 658681 379253 501772 514...
output:
853045231
result:
ok "853045231"
Test #30:
score: 0
Accepted
time: 68ms
memory: 5952kb
input:
179757 387501 265947 758985 119960 261157 276800 872564 577739 710732 499800 619138 866122 60938 241380 958452 491031 369840 950198 357312 899288 916811 549945 242903 986314 691991 394014 842244 954182 483834 670496 367841 314555 530992 936765 786751 896245 680668 658496 833274 268818 405741 752313 ...
output:
282651116
result:
ok "282651116"
Test #31:
score: 0
Accepted
time: 37ms
memory: 4988kb
input:
101131 213916 161323 738027 129127 462867 638993 707384 748480 854879 119514 310999 781525 198041 202797 640663 390249 73700 711833 377483 393162 435179 404120 593959 924502 717818 504604 960336 695342 650173 981223 231562 769331 975336 85467 368268 981144 632126 108778 808574 201730 435643 743515 4...
output:
844847230
result:
ok "844847230"
Test #32:
score: 0
Accepted
time: 45ms
memory: 6260kb
input:
128347 620339 210751 279805 81982 612031 680204 602472 66571 554065 812905 457334 681466 32981 401742 544541 701200 173499 340275 326227 397622 407744 873583 625647 660328 662307 470545 987756 131619 253769 879431 10637 491395 610211 204956 508606 723226 606636 26758 916612 875439 420505 820967 5056...
output:
945687897
result:
ok "945687897"
Test #33:
score: 0
Accepted
time: 10ms
memory: 6176kb
input:
48603 181670 133994 515210 303772 627136 888063 335413 333602 582290 762140 6913 146030 9594 398485 816273 570188 193926 209198 987883 240787 982208 944102 602024 926665 392885 26566 948154 664971 385443 716315 810190 641302 927907 269082 44234 791221 727613 40810 430932 580793 228793 454293 907456 ...
output:
407094680
result:
ok "407094680"
Test #34:
score: 0
Accepted
time: 7ms
memory: 4096kb
input:
20580 579594 340581 847611 879915 33651 434851 380626 398791 954840 957041 728893 735214 158256 183308 358157 752571 205225 437164 299756 451063 597234 202522 52205 861684 217418 16187 991490 896694 304903 343738 774337 297668 328943 30399 65525 341249 987796 233050 790101 378708 146600 343291 71330...
output:
674692236
result:
ok "674692236"
Test #35:
score: 0
Accepted
time: 76ms
memory: 6036kb
input:
195800 994168 991630 995019 992856 992625 995643 991781 996621 998628 999447 991572 998002 999900 993432 999447 998450 994806 996221 998717 992890 999635 995308 997058 999646 991958 996580 997267 998141 994257 998010 998439 990152 992242 990155 990582 991372 997043 990787 999340 998786 990537 999588...
output:
563495196
result:
ok "563495196"
Test #36:
score: 0
Accepted
time: 71ms
memory: 6164kb
input:
191861 995655 995765 998346 992810 995607 998808 999490 990910 993583 994255 992766 993277 996358 992032 995335 995423 992355 997464 995907 994020 994531 998512 995011 995957 991059 991487 994833 999029 993505 999824 994301 990539 996883 990974 995960 998899 996273 992715 994789 995451 994393 995561...
output:
714020568
result:
ok "714020568"
Test #37:
score: 0
Accepted
time: 103ms
memory: 6216kb
input:
195565 999063 990229 995348 991671 991027 994025 990155 990747 993982 991033 997087 999443 999047 992115 994719 997093 994742 994925 999449 991635 995000 996745 992115 998302 994535 993249 998125 993474 994270 995511 999371 991646 993215 998669 991581 998438 997178 990203 991329 994673 993736 999172...
output:
116268365
result:
ok "116268365"
Test #38:
score: 0
Accepted
time: 98ms
memory: 6112kb
input:
192351 994633 992295 993866 999491 995154 999978 998662 993968 998923 997515 994463 996273 996783 991646 992688 998741 992229 993768 995616 995627 999486 991649 993139 996217 992887 991777 998183 993388 991390 994258 990163 991664 994887 993852 993134 999831 994674 993351 997757 990416 992326 996552...
output:
730221109
result:
ok "730221109"
Test #39:
score: 0
Accepted
time: 94ms
memory: 6168kb
input:
190258 994252 991461 992838 991977 992522 994656 995231 996156 997556 993258 992754 998837 990154 994145 999058 991687 990970 998089 990148 995397 999489 999678 991808 995208 991100 990876 998046 994535 990729 996117 999727 995309 999959 996293 990570 992551 996178 995317 996398 998786 995335 998231...
output:
314668259
result:
ok "314668259"
Extra Test:
score: 0
Extra Test Passed