QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#706202 | #8149. Station of Fate | Yaimsea# | AC ✓ | 2ms | 6292kb | C++20 | 649b | 2024-11-03 09:18:15 | 2024-11-03 09:18:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const long long MOD=998244353;
const long long maxn=1e5;
long long n,m,inv[100010],finv[100010],frac[100010];
inline void init()
{
long long i;
inv[1]=1;
for(i=2;i<=maxn;++i)
inv[i]=(MOD-MOD/i)*inv[MOD%i]%MOD;
finv[0]=1,frac[0]=1;
for(i=1;i<=maxn;++i)
frac[i]=frac[i-1]*i%MOD,finv[i]=finv[i-1]*inv[i]%MOD;
return;
}
inline long long C(long long i,long long j)
{
return frac[i]*finv[j]%MOD*finv[i-j]%MOD;
}
int main()
{
long long T;
init();
scanf("%lld",&T);
while(T--)
{
scanf("%lld %lld",&n,&m);
printf("%lld\n",frac[n]*C(n-1,m-1)%MOD);
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 6212kb
input:
2 3 2 6 3
output:
12 7200
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 6208kb
input:
4 6 5 2 2 7 5 1 1
output:
3600 2 75600 1
result:
ok 4 lines
Test #3:
score: 0
Accepted
time: 2ms
memory: 6152kb
input:
8 10 3 3 3 4 4 9 7 8 2 6 4 7 2 2 2
output:
130636800 6 24 10160640 282240 7200 30240 2
result:
ok 8 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 6292kb
input:
2 3 3 1 1
output:
6 1
result:
ok 2 lines
Test #5:
score: 0
Accepted
time: 2ms
memory: 6288kb
input:
6 3 1 9 2 6 4 5 5 8 1 8 4
output:
6 2903040 7200 120 40320 1411200
result:
ok 6 lines
Test #6:
score: 0
Accepted
time: 2ms
memory: 6096kb
input:
4 7 1 6 6 3 3 3 2
output:
5040 720 6 12
result:
ok 4 lines
Test #7:
score: 0
Accepted
time: 0ms
memory: 6144kb
input:
8 2 1 10 6 7 6 1 1 7 2 1 1 2 1 7 1
output:
2 457228800 30240 1 30240 1 2 5040
result:
ok 8 lines
Test #8:
score: 0
Accepted
time: 0ms
memory: 6152kb
input:
2 6 5 8 4
output:
3600 1411200
result:
ok 2 lines
Test #9:
score: 0
Accepted
time: 0ms
memory: 6128kb
input:
6 1 1 5 1 1 1 7 1 1 1 4 1
output:
1 120 1 5040 1 24
result:
ok 6 lines
Test #10:
score: 0
Accepted
time: 2ms
memory: 6200kb
input:
4 3 3 7 2 6 5 5 5
output:
6 30240 3600 120
result:
ok 4 lines
Test #11:
score: 0
Accepted
time: 2ms
memory: 6228kb
input:
8 7 7 3 2 10 5 7 3 2 2 2 1 8 7 9 2
output:
5040 12 457228800 75600 2 2 282240 2903040
result:
ok 8 lines
Test #12:
score: 0
Accepted
time: 0ms
memory: 6220kb
input:
3 5 5 7 2 7 5
output:
120 30240 75600
result:
ok 3 lines
Test #13:
score: 0
Accepted
time: 2ms
memory: 6228kb
input:
7 6 6 10 9 6 2 3 2 6 1 5 1 8 5
output:
720 32659200 3600 12 720 120 1411200
result:
ok 7 lines
Test #14:
score: 0
Accepted
time: 0ms
memory: 6232kb
input:
5 10 8 2 1 8 3 1 1 9 5
output:
130636800 2 846720 1 25401600
result:
ok 5 lines
Test #15:
score: 0
Accepted
time: 0ms
memory: 6100kb
input:
5 4 2 10 7 5 2 5 1 7 3
output:
72 304819200 480 120 75600
result:
ok 5 lines
Test #16:
score: 0
Accepted
time: 2ms
memory: 6292kb
input:
3 5 2 3 2 10 10
output:
480 12 3628800
result:
ok 3 lines
Test #17:
score: 0
Accepted
time: 0ms
memory: 6212kb
input:
7 1 1 1 1 7 3 5 2 5 3 4 3 3 1
output:
1 1 75600 480 720 72 6
result:
ok 7 lines
Test #18:
score: 0
Accepted
time: 2ms
memory: 6096kb
input:
5 1 1 2 1 8 8 3 3 4 1
output:
1 2 40320 6 24
result:
ok 5 lines
Test #19:
score: 0
Accepted
time: 2ms
memory: 6216kb
input:
5 6 4 10 3 2 2 1 1 6 3
output:
7200 130636800 2 1 7200
result:
ok 5 lines
Test #20:
score: 0
Accepted
time: 2ms
memory: 6148kb
input:
8 52 4 68 41 82 17 73 15 44 25 84 34 81 23 59 57
output:
39982437 271239302 659623801 934460400 185497846 837342411 814841564 789353276
result:
ok 8 lines
Test #21:
score: 0
Accepted
time: 2ms
memory: 6212kb
input:
6 96 13 45 10 58 6 65 5 27 20 32 20
output:
874674746 960491694 841472716 464834414 219251731 874952304
result:
ok 6 lines
Test #22:
score: 0
Accepted
time: 2ms
memory: 6224kb
input:
10 41 40 27 3 35 8 49 26 9 7 76 10 52 15 85 9 18 18 56 51
output:
492930323 882449802 900179189 771749206 10160640 488118527 405368968 979829969 781263551 497919252
result:
ok 10 lines
Test #23:
score: 0
Accepted
time: 2ms
memory: 6220kb
input:
8 85 1 5 5 100 61 41 3 91 39 15 8 93 73 6 3
output:
16057347 120 842539856 128819945 156454026 523183657 973779611 7200
result:
ok 8 lines
Test #24:
score: 0
Accepted
time: 2ms
memory: 6200kb
input:
8 34 4 86 1 77 72 25 10 73 4 63 3 26 21 23 15
output:
354574941 382687489 739189855 471447359 612446137 478384314 551396676 408577186
result:
ok 8 lines
Test #25:
score: 0
Accepted
time: 2ms
memory: 6288kb
input:
6 78 54 56 9 50 24 17 8 56 51 3 3
output:
997308517 577220778 541775810 852610907 497919252 6
result:
ok 6 lines
Test #26:
score: 0
Accepted
time: 2ms
memory: 6092kb
input:
4 22 4 34 2 18 17 5 4
output:
691513282 181265065 304303778 480
result:
ok 4 lines
Test #27:
score: 0
Accepted
time: 2ms
memory: 6204kb
input:
4 67 11 11 7 95 92 89 51
output:
946025081 396573176 418897868 350643437
result:
ok 4 lines
Test #28:
score: 0
Accepted
time: 0ms
memory: 6128kb
input:
2 11 11 89 61
output:
39916800 349658757
result:
ok 2 lines
Test #29:
score: 0
Accepted
time: 2ms
memory: 6072kb
input:
2 75 2 64 20
output:
430396733 217962367
result:
ok 2 lines
Test #30:
score: 0
Accepted
time: 0ms
memory: 6288kb
input:
6 19 2 41 6 37 31 74 12 31 1 19 18
output:
660892191 862115478 139356370 551489651 837902046 660892191
result:
ok 6 lines
Test #31:
score: 0
Accepted
time: 2ms
memory: 6092kb
input:
10 64 14 11 8 10 10 58 27 13 13 63 16 24 5 2 1 13 9 22 8
output:
557357410 797038588 3628800 486349895 237554682 132868771 258149155 2 794978289 420750853
result:
ok 10 lines
Test #32:
score: 0
Accepted
time: 0ms
memory: 6292kb
input:
8 8 7 89 7 83 53 46 33 95 5 6 2 61 6 11 4
output:
282240 558761000 247006727 115795523 545727320 3600 762960984 797038588
result:
ok 8 lines
Test #33:
score: 0
Accepted
time: 2ms
memory: 6132kb
input:
2 52 49 70 2
output:
39982437 16481341
result:
ok 2 lines
Test #34:
score: 0
Accepted
time: 2ms
memory: 6208kb
input:
6 1 1 48 48 25 12 22 18 60 34 97 78
output:
1 380026194 446288434 117076710 349763487 43065423
result:
ok 6 lines
Test #35:
score: 0
Accepted
time: 0ms
memory: 6288kb
input:
10 45 28 30 14 1 1 14 13 42 38 37 23 68 45 62 41 46 19 1 1
output:
77506939 22901230 1 310444945 689379926 294148158 214108944 367008976 927343161 1
result:
ok 10 lines
Test #36:
score: 0
Accepted
time: 2ms
memory: 6128kb
input:
8 89 29 99 84 78 1 2 1 24 9 85 38 6 2 83 62
output:
349658757 836814330 90208990 2 461272891 776349572 3600 838348350
result:
ok 8 lines
Test #37:
score: 0
Accepted
time: 2ms
memory: 6216kb
input:
2 34 20 81 68
output:
420789557 770903860
result:
ok 2 lines
Test #38:
score: 0
Accepted
time: 0ms
memory: 6208kb
input:
5 560 519 423 196 772 151 331 151 5 5
output:
224583847 222043816 404450950 92116981 120
result:
ok 5 lines
Test #39:
score: 0
Accepted
time: 0ms
memory: 6212kb
input:
9 404 73 604 196 549 368 319 254 187 119 798 257 148 124 719 219 552 148
output:
558015591 884303974 318720173 990055902 647418113 54221407 647329756 752217375 830365465
result:
ok 9 lines
Test #40:
score: 0
Accepted
time: 2ms
memory: 6232kb
input:
3 545 257 274 210 326 66
output:
31136345 58684463 713907074
result:
ok 3 lines
Test #41:
score: 0
Accepted
time: 0ms
memory: 6092kb
input:
1 901 719
output:
398641845
result:
ok single line: '398641845'
Test #42:
score: 0
Accepted
time: 0ms
memory: 6140kb
input:
1 42 36
output:
860786995
result:
ok single line: '860786995'
Test #43:
score: 0
Accepted
time: 0ms
memory: 6132kb
input:
9 886 41 115 28 144 76 975 175 212 84 876 810 793 263 579 25 873 276
output:
794905646 557068111 31423464 313723187 436744372 350775943 331111190 272620083 384057763
result:
ok 9 lines
Test #44:
score: 0
Accepted
time: 2ms
memory: 6132kb
input:
7 730 705 888 428 113 66 259 59 98 43 428 260 522 501
output:
155416980 883205820 882673440 361440356 31164727 332054930 384406342
result:
ok 7 lines
Test #45:
score: 0
Accepted
time: 2ms
memory: 6220kb
input:
1 871 754
output:
724315609
result:
ok single line: '724315609'
Test #46:
score: 0
Accepted
time: 2ms
memory: 6244kb
input:
5 419 317 740 367 963 641 235 9 759 26
output:
201739865 13753903 749794434 611763544 853230443
result:
ok 5 lines
Test #47:
score: 0
Accepted
time: 0ms
memory: 6076kb
input:
10 854 458 826 470 639 184 341 241 907 704 612 12 790 376 981 971 104 93 122 95
output:
256793038 774842340 798925933 439127018 366280380 562046398 771059314 585051113 308055721 274696149
result:
ok 10 lines
Test #48:
score: 0
Accepted
time: 2ms
memory: 6208kb
input:
4 698 76 8 6 416 294 625 296
output:
642780447 846720 253330445 144993221
result:
ok 4 lines
Test #49:
score: 0
Accepted
time: 0ms
memory: 6096kb
input:
2 838 492 486 69
output:
192270029 487779646
result:
ok 2 lines
Test #50:
score: 0
Accepted
time: 0ms
memory: 6144kb
input:
6 387 51 667 584 458 369 305 166 454 389 843 68
output:
317192048 83613566 124745253 683129470 748363075 746714895
result:
ok 6 lines
Test #51:
score: 0
Accepted
time: 0ms
memory: 6216kb
input:
4 39 21 145 22 530 512 589 331
output:
959832615 186634433 847557653 949765269
result:
ok 4 lines
Test #52:
score: 0
Accepted
time: 2ms
memory: 6148kb
input:
4 179 179 518 498 307 225 281 176
output:
146496641 856405921 832301506 654633596
result:
ok 4 lines
Test #53:
score: 0
Accepted
time: 2ms
memory: 6216kb
input:
2 24 6 996 378
output:
980966789 226711095
result:
ok 2 lines
Test #54:
score: 0
Accepted
time: 0ms
memory: 6156kb
input:
6 164 124 770 289 349 90 449 352 183 94 921 462
output:
318586645 401734042 292363028 190526234 350986227 450765210
result:
ok 6 lines
Test #55:
score: 0
Accepted
time: 2ms
memory: 6288kb
input:
10 713 166 951 570 126 67 437 145 69 9 961 86 80 80 405 221 962 158 992 849
output:
419806325 240106754 206236354 112875464 835946624 80145652 123291237 525911603 516577417 886319728
result:
ok 10 lines
Test #56:
score: 0
Accepted
time: 2ms
memory: 6288kb
input:
1 8439 4069
output:
828742246
result:
ok single line: '828742246'
Test #57:
score: 0
Accepted
time: 0ms
memory: 6100kb
input:
5 7283 4418 2471 1346 628 364 5578 1648 9646 3721
output:
157411182 944954286 239403207 542492022 947056188
result:
ok 5 lines
Test #58:
score: 0
Accepted
time: 0ms
memory: 6228kb
input:
3 9232 7068 4652 2362 6700 3511
output:
933205738 318293829 425150546
result:
ok 3 lines
Test #59:
score: 0
Accepted
time: 0ms
memory: 6232kb
input:
7 8076 2470 1426 547 5477 4611 850 9 8010 4606 233 210 1559 1347
output:
546787175 104416094 106413685 503449209 511834055 196109647 804242947
result:
ok 7 lines
Test #60:
score: 0
Accepted
time: 2ms
memory: 6216kb
input:
1 6920 6408
output:
975343899
result:
ok single line: '975343899'
Test #61:
score: 0
Accepted
time: 0ms
memory: 6136kb
input:
5 5765 262 7277 3747 4519 2877 8826 6878 6375 4392
output:
363764381 627921821 904963162 276330072 190811860
result:
ok 5 lines
Test #62:
score: 0
Accepted
time: 2ms
memory: 6212kb
input:
3 4609 2900 6755 5994 3296 3164
output:
105349051 170438248 734888794
result:
ok 3 lines
Test #63:
score: 0
Accepted
time: 2ms
memory: 6072kb
input:
1 749 544
output:
934333401
result:
ok single line: '934333401'
Test #64:
score: 0
Accepted
time: 2ms
memory: 6132kb
input:
1 5402 3288
output:
600158732
result:
ok single line: '600158732'
Test #65:
score: 0
Accepted
time: 2ms
memory: 6220kb
input:
2 2041 464 1176 107
output:
33123429 543400471
result:
ok 2 lines
Test #66:
score: 0
Accepted
time: 2ms
memory: 6224kb
input:
10 8181 143 654 157 9000 3233 5655 1959 3206 2515 5368 1447 6719 1442 8593 957 616 226 7306 4276
output:
165214484 869486415 596706497 2481529 859531534 417082059 97781866 629836032 500915428 73960289
result:
ok 10 lines
Test #67:
score: 0
Accepted
time: 0ms
memory: 6212kb
input:
8 7026 6035 2835 559 7777 3673 2347 1479 4684 531 2407 1154 8961 6098 6510 593
output:
329712907 644269433 855841468 779406453 188455259 939708219 237688082 255537990
result:
ok 8 lines
Test #68:
score: 0
Accepted
time: 2ms
memory: 6132kb
input:
2 4382 4380 6505 4013
output:
72277357 145143428
result:
ok 2 lines
Test #69:
score: 0
Accepted
time: 0ms
memory: 6204kb
input:
6 522 352 8687 2809 6818 1454 7619 3760 5753 57 9191 972
output:
5356580 105834590 703800247 661809240 711745647 319795478
result:
ok 6 lines
Test #70:
score: 0
Accepted
time: 2ms
memory: 6216kb
input:
10 9367 1856 5460 2063 8299 542 4311 1073 7231 6899 4742 4354 8660 7902 7157 730 4641 2958 5485 2615
output:
779939812 83420746 376354566 95530774 811358140 924898194 561764128 164893050 788549479 613176628
result:
ok 10 lines
Test #71:
score: 0
Accepted
time: 2ms
memory: 6224kb
input:
8 5507 1776 7642 1692 8564 4005 5595 3211 4117 1104 4486 536 901 259 5075 2805
output:
172642866 995711443 193398173 649223413 698044044 607892436 851365101 982532033
result:
ok 8 lines
Test #72:
score: 0
Accepted
time: 2ms
memory: 6152kb
input:
2 4352 2075 7120 986
output:
810767948 626952151
result:
ok 2 lines
Test #73:
score: 0
Accepted
time: 2ms
memory: 6152kb
input:
6 1708 1049 3493 364 6118 1876 3571 1823 2482 658 1269 76
output:
639726997 802138976 36785679 437127270 286574481 417811894
result:
ok 6 lines
Test #74:
score: 0
Accepted
time: 2ms
memory: 6204kb
input:
9 87434 18786 61935 32238 30947 26551 23916 15505 37068 5689 15503 10736 91843 64194 19310 17938 97851 53615
output:
740433337 754260472 945929763 912420722 248743473 500672084 508361655 253435004 18175603
result:
ok 9 lines
Test #75:
score: 0
Accepted
time: 0ms
memory: 6288kb
input:
3 3575 2945 24117 19792 1212 58
output:
285491450 526380387 697368821
result:
ok 3 lines
Test #76:
score: 0
Accepted
time: 2ms
memory: 6132kb
input:
1 52419 18907
output:
302727133
result:
ok single line: '302727133'
Test #77:
score: 0
Accepted
time: 0ms
memory: 6232kb
input:
1 68559 51458
output:
426641101
result:
ok single line: '426641101'
Test #78:
score: 0
Accepted
time: 2ms
memory: 6228kb
input:
9 50108 4955 69446 1738 29030 6808 59869 29274 53797 38957 97581 72896 83784 56865 2466 238 44980 10254
output:
914946185 408100232 736050535 357119619 386050218 420411430 409982877 287573145 306537717
result:
ok 9 lines
Test #79:
score: 0
Accepted
time: 2ms
memory: 6132kb
input:
3 98952 19428 31627 18956 7807 4746
output:
210076619 336811952 938131969
result:
ok 3 lines
Test #80:
score: 0
Accepted
time: 2ms
memory: 6096kb
input:
1 90900 78422
output:
12156477
result:
ok single line: '12156477'
Test #81:
score: 0
Accepted
time: 2ms
memory: 6228kb
input:
5 39745 25365 14774 1214 89553 56444 11833 641 66344 34702
output:
220673476 24771736 362443867 450413979 744952088
result:
ok 5 lines
Test #82:
score: 0
Accepted
time: 2ms
memory: 6204kb
input:
9 88589 77144 76956 38002 68329 11726 28525 7988 3230 1492 79660 78275 8429 3056 51030 9987 16301 8398
output:
972101024 166704036 236677996 585400242 903325956 758756980 873867190 664618510 972169186
result:
ok 9 lines
Test #83:
score: 0
Accepted
time: 2ms
memory: 6128kb
input:
10 53147 36494 98420 89793 33872 7356 92216 11919 90726 84066 97958 13328 56383 51573 50196 29811 14439 5689 61663 1468
output:
903664644 298024675 442127369 683142524 540294631 708578072 818697356 811417441 775014338 172089902
result:
ok 10 lines
Test #84:
score: 0
Accepted
time: 2ms
memory: 6260kb
input:
8 1991 1903 27898 7811 4137 3063 8908 6926 94908 51776 806 240 50113 10442 98114 6242
output:
652569158 714645521 910927417 12001235 933248366 108354530 834119799 387529839
result:
ok 8 lines
Test #85:
score: 0
Accepted
time: 2ms
memory: 6136kb
input:
3 18132 14729 90080 69469 82914 49991
output:
487209698 45840153 505009143
result:
ok 3 lines
Test #86:
score: 0
Accepted
time: 2ms
memory: 6216kb
input:
7 42784 3383 19557 7294 61691 57185 76884 72749 3272 2743 20293 13140 46083 17864
output:
746528694 468984111 873621164 704042716 548821290 750801833 41476894
result:
ok 7 lines
Test #87:
score: 0
Accepted
time: 0ms
memory: 6132kb
input:
5 58924 44444 81739 41859 31956 5697 60872 40484 7455 4865
output:
887734114 894245152 929939065 113378965 596403734
result:
ok 5 lines
Test #88:
score: 0
Accepted
time: 0ms
memory: 6144kb
input:
9 40473 22549 2704 1117 10732 2469 44860 9588 11637 10627 82884 1681 42054 25523 46678 42936 66023 62050
output:
459403515 360392380 471656659 709923943 936420878 53145038 632138940 258650363 390159000
result:
ok 9 lines
Test #89:
score: 0
Accepted
time: 2ms
memory: 6224kb
input:
7 89317 78616 64886 8559 56805 30914 28848 5651 83115 82785 42628 30315 44295 32638
output:
542747260 529406826 710669380 805439768 246951063 766402308 189557282
result:
ok 7 lines
Test #90:
score: 0
Accepted
time: 2ms
memory: 6284kb
input:
7 5458 3025 94364 41348 59774 39535 12836 8867 20001 11713 2372 950 70728 36805
output:
480362124 718294440 825550374 495306820 395117221 767301440 249914777
result:
ok 7 lines
Test #91:
score: 0
Accepted
time: 0ms
memory: 6288kb
input:
5 54302 3597 56545 25667 71255 15625 96824 10330 24184 20149
output:
305337010 979571194 644419618 268539573 452863477
result:
ok 5 lines
Extra Test:
score: 0
Extra Test Passed