QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#164128 | #4281. Subspace | ucup-team004 | AC ✓ | 41ms | 3572kb | C++20 | 1.4kb | 2023-09-04 20:09:44 | 2023-09-04 20:09:44 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
int power(int a, int b, int p) {
int res = 1;
for (; b; b /= 2, a = 1LL * a * a % p) {
if (b % 2) {
res = 1LL * res * a % p;
}
}
return res;
}
int qint(int n, int q, int p) {
return 1LL * (power(q, n, p) - 1) * power(q - 1, p - 2, p) % p;
}
int qBinomial(int n, int k, int q, int p) {
if (q == 0) {
return 1;
}
int r = 0;
int x = 1;
do {
x = 1LL * x * q % p;
r++;
} while (x != 1);
if (n / r > k / r + (n - k) / r) {
return 0;
}
int num = 1, den = 1;
for (int i = 1; i <= k % r; i++) {
num = 1LL * num * qint(n % r - i + 1, q, p) % p;
den = 1LL * den * qint(i, q, p) % p;
}
n /= r, k /= r;
while (n > 0 || k > 0) {
if (n % p < k % p) {
return 0;
}
for (int i = 1; i <= k % p; i++) {
num = 1LL * num * (n % p - i + 1) % p;
den = 1LL * den * i % p;
}
n /= p, k /= p;
}
int ans = 1LL * num * power(den, p - 2, p) % p;
return ans;
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int q, n, k, p;
std::cin >> q >> n >> k >> p;
q %= p;
std::cout << qBinomial(n, k, q, p) << "\n";
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3528kb
input:
2 3 2 100003
output:
7
result:
ok 1 number(s): "7"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
408456817 56768983 38223849 50147
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 3ms
memory: 3400kb
input:
129129379 529593615 39885429 143329
output:
42442
result:
ok 1 number(s): "42442"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
197945609 281430168 132969220 116741
output:
109225
result:
ok 1 number(s): "109225"
Test #5:
score: 0
Accepted
time: 5ms
memory: 3376kb
input:
851906999 846249246 767385134 94261
output:
89276
result:
ok 1 number(s): "89276"
Test #6:
score: 0
Accepted
time: 1ms
memory: 3328kb
input:
663155401 766616649 135552964 50263
output:
0
result:
ok 1 number(s): "0"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
343426561 743178974 441611099 35507
output:
0
result:
ok 1 number(s): "0"
Test #8:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
491579489 533731406 64631451 19699
output:
1439
result:
ok 1 number(s): "1439"
Test #9:
score: 0
Accepted
time: 20ms
memory: 3392kb
input:
681109939 328931838 253549559 84697
output:
69554
result:
ok 1 number(s): "69554"
Test #10:
score: 0
Accepted
time: 2ms
memory: 3344kb
input:
845114717 429816092 324385541 142097
output:
0
result:
ok 1 number(s): "0"
Test #11:
score: 0
Accepted
time: 40ms
memory: 3400kb
input:
566783837 266048672 113943696 171467
output:
154961
result:
ok 1 number(s): "154961"
Test #12:
score: 0
Accepted
time: 4ms
memory: 3396kb
input:
370970653 329045741 141987161 105407
output:
90140
result:
ok 1 number(s): "90140"
Test #13:
score: 0
Accepted
time: 1ms
memory: 3372kb
input:
144057071 427646134 294853328 144349
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
802639393 911383284 887157686 659
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 1ms
memory: 3340kb
input:
562550623 454156925 145617900 16249
output:
0
result:
ok 1 number(s): "0"
Test #16:
score: 0
Accepted
time: 11ms
memory: 3412kb
input:
560140069 974310829 125295010 179479
output:
130026
result:
ok 1 number(s): "130026"
Test #17:
score: 0
Accepted
time: 13ms
memory: 3396kb
input:
531020783 442942833 217629176 194203
output:
58949
result:
ok 1 number(s): "58949"
Test #18:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
297350401 157940887 29007719 61141
output:
0
result:
ok 1 number(s): "0"
Test #19:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
454822637 540388640 38740586 34361
output:
0
result:
ok 1 number(s): "0"
Test #20:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
230178367 343238506 178554361 53623
output:
26649
result:
ok 1 number(s): "26649"
Test #21:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
613360057 538937302 169899111 85667
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 0
Accepted
time: 0ms
memory: 3412kb
input:
363215087 99500022 42432820 98911
output:
15075
result:
ok 1 number(s): "15075"
Test #23:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
239114507 819106154 199647285 16823
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
336694277 487557837 472662288 67891
output:
0
result:
ok 1 number(s): "0"
Test #25:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
847820117 951329769 673476349 191413
output:
0
result:
ok 1 number(s): "0"
Test #26:
score: 0
Accepted
time: 2ms
memory: 3364kb
input:
449061653 222055274 115131818 153877
output:
0
result:
ok 1 number(s): "0"
Test #27:
score: 0
Accepted
time: 41ms
memory: 3432kb
input:
521050171 627097298 232682343 171401
output:
166636
result:
ok 1 number(s): "166636"
Test #28:
score: 0
Accepted
time: 9ms
memory: 3568kb
input:
654161737 89831246 54394291 122609
output:
116073
result:
ok 1 number(s): "116073"
Test #29:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
4466911 221595494 103061673 129499
output:
0
result:
ok 1 number(s): "0"
Test #30:
score: 0
Accepted
time: 0ms
memory: 3344kb
input:
6866287 245321206 52456318 87973
output:
15400
result:
ok 1 number(s): "15400"
Test #31:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
290645891 346816375 288860608 155849
output:
0
result:
ok 1 number(s): "0"
Test #32:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
976725637 843892163 796581581 2333
output:
0
result:
ok 1 number(s): "0"
Test #33:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
201797257 417631577 122501139 37117
output:
0
result:
ok 1 number(s): "0"
Test #34:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
600318139 932259272 40189295 1973
output:
0
result:
ok 1 number(s): "0"
Test #35:
score: 0
Accepted
time: 0ms
memory: 3400kb
input:
417947903 891308909 249147515 52999
output:
33508
result:
ok 1 number(s): "33508"
Test #36:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
599796539 498934003 320109323 34679
output:
0
result:
ok 1 number(s): "0"
Test #37:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
660637253 502326517 27520504 176779
output:
0
result:
ok 1 number(s): "0"
Test #38:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
36918041 192598182 13123569 9203
output:
0
result:
ok 1 number(s): "0"
Test #39:
score: 0
Accepted
time: 2ms
memory: 3504kb
input:
60153329 198669246 39693500 156781
output:
44496
result:
ok 1 number(s): "44496"
Test #40:
score: 0
Accepted
time: 1ms
memory: 3344kb
input:
388662101 950697886 669345806 85903
output:
0
result:
ok 1 number(s): "0"
Test #41:
score: 0
Accepted
time: 1ms
memory: 3340kb
input:
946719461 33485758 18291463 18043
output:
0
result:
ok 1 number(s): "0"
Test #42:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
230141441 270893542 106156273 143467
output:
0
result:
ok 1 number(s): "0"
Test #43:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
688768637 963385655 643948513 1867
output:
0
result:
ok 1 number(s): "0"
Test #44:
score: 0
Accepted
time: 15ms
memory: 3400kb
input:
258528689 932798088 842045027 72701
output:
64159
result:
ok 1 number(s): "64159"
Test #45:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
548302453 488266165 46556407 192889
output:
0
result:
ok 1 number(s): "0"
Test #46:
score: 0
Accepted
time: 10ms
memory: 3396kb
input:
662832539 164806398 159270309 131611
output:
76512
result:
ok 1 number(s): "76512"
Test #47:
score: 0
Accepted
time: 5ms
memory: 3512kb
input:
619706333 380201915 137006130 115771
output:
52568
result:
ok 1 number(s): "52568"
Test #48:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
181071367 421359633 8085267 173671
output:
130077
result:
ok 1 number(s): "130077"
Test #49:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
148246727 604268916 474779416 97673
output:
0
result:
ok 1 number(s): "0"
Test #50:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
230553119 430168885 400447146 45817
output:
0
result:
ok 1 number(s): "0"
Test #51:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
279067883 509357885 453916649 174407
output:
0
result:
ok 1 number(s): "0"
Test #52:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
153177001 684608985 203936293 62483
output:
0
result:
ok 1 number(s): "0"
Test #53:
score: 0
Accepted
time: 1ms
memory: 3340kb
input:
443422381 735963292 39812669 58067
output:
0
result:
ok 1 number(s): "0"
Test #54:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
169433059 532615008 468164650 133717
output:
0
result:
ok 1 number(s): "0"
Test #55:
score: 0
Accepted
time: 6ms
memory: 3396kb
input:
735436187 150020008 137745714 36749
output:
8992
result:
ok 1 number(s): "8992"
Test #56:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
19603867 684349184 107730541 118219
output:
0
result:
ok 1 number(s): "0"
Test #57:
score: 0
Accepted
time: 1ms
memory: 3344kb
input:
833224981 404335869 296079192 130379
output:
0
result:
ok 1 number(s): "0"
Test #58:
score: 0
Accepted
time: 2ms
memory: 3572kb
input:
948556919 554213096 496185170 150067
output:
0
result:
ok 1 number(s): "0"
Test #59:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
54073741 784577622 383693088 63473
output:
0
result:
ok 1 number(s): "0"
Test #60:
score: 0
Accepted
time: 0ms
memory: 3412kb
input:
773692643 293169948 102659773 186733
output:
0
result:
ok 1 number(s): "0"
Test #61:
score: 0
Accepted
time: 2ms
memory: 3524kb
input:
513495613 862710333 382684887 190591
output:
0
result:
ok 1 number(s): "0"
Test #62:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
528905081 750056878 101154326 189671
output:
17444
result:
ok 1 number(s): "17444"
Test #63:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
562837901 843389575 208898824 7237
output:
0
result:
ok 1 number(s): "0"
Test #64:
score: 0
Accepted
time: 28ms
memory: 3380kb
input:
673944191 44876089 25478552 185551
output:
100860
result:
ok 1 number(s): "100860"
Test #65:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
598698047 530570085 41691064 168451
output:
0
result:
ok 1 number(s): "0"
Test #66:
score: 0
Accepted
time: 2ms
memory: 3524kb
input:
930490559 280428977 12707046 190823
output:
0
result:
ok 1 number(s): "0"
Test #67:
score: 0
Accepted
time: 3ms
memory: 3436kb
input:
830736359 768835537 531469871 32303
output:
16448
result:
ok 1 number(s): "16448"
Test #68:
score: 0
Accepted
time: 12ms
memory: 3508kb
input:
302512523 871671916 678540117 55339
output:
42869
result:
ok 1 number(s): "42869"
Test #69:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
199094549 9221871 5013498 89759
output:
0
result:
ok 1 number(s): "0"
Test #70:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
507033047 58944189 8657783 134269
output:
0
result:
ok 1 number(s): "0"
Test #71:
score: 0
Accepted
time: 2ms
memory: 3380kb
input:
316934911 865228476 580289141 154487
output:
0
result:
ok 1 number(s): "0"
Test #72:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
751576379 53995037 1583045 88657
output:
0
result:
ok 1 number(s): "0"
Test #73:
score: 0
Accepted
time: 2ms
memory: 3492kb
input:
537909683 812333628 275607904 197203
output:
0
result:
ok 1 number(s): "0"
Test #74:
score: 0
Accepted
time: 3ms
memory: 3428kb
input:
920471323 723968104 580288790 47843
output:
10278
result:
ok 1 number(s): "10278"
Test #75:
score: 0
Accepted
time: 1ms
memory: 3340kb
input:
30987353 318429849 33169427 196193
output:
0
result:
ok 1 number(s): "0"
Test #76:
score: 0
Accepted
time: 5ms
memory: 3440kb
input:
958461227 993651037 97006791 22637
output:
10865
result:
ok 1 number(s): "10865"
Test #77:
score: 0
Accepted
time: 2ms
memory: 3436kb
input:
717872633 879912089 526079313 23509
output:
0
result:
ok 1 number(s): "0"
Test #78:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
39295889 273524091 148089232 27481
output:
0
result:
ok 1 number(s): "0"
Test #79:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
108890549 735519123 541834201 27997
output:
0
result:
ok 1 number(s): "0"
Test #80:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
696036223 136941236 20385401 141671
output:
0
result:
ok 1 number(s): "0"
Test #81:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
369084487 351521704 150189901 19273
output:
0
result:
ok 1 number(s): "0"
Test #82:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
327540461 170256633 81045466 17903
output:
0
result:
ok 1 number(s): "0"
Test #83:
score: 0
Accepted
time: 1ms
memory: 3376kb
input:
216256429 464571440 131449433 40597
output:
0
result:
ok 1 number(s): "0"
Test #84:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
628199867 15336783 452548 187129
output:
0
result:
ok 1 number(s): "0"
Test #85:
score: 0
Accepted
time: 0ms
memory: 3376kb
input:
995177629 139492400 87480011 42409
output:
0
result:
ok 1 number(s): "0"
Test #86:
score: 0
Accepted
time: 0ms
memory: 3400kb
input:
790520039 879982919 217776963 1997
output:
0
result:
ok 1 number(s): "0"
Test #87:
score: 0
Accepted
time: 4ms
memory: 3528kb
input:
860199089 910876516 233444838 20639
output:
0
result:
ok 1 number(s): "0"
Test #88:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
268393403 850928657 547387638 57737
output:
0
result:
ok 1 number(s): "0"
Test #89:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
319521571 419056660 28136514 72169
output:
59715
result:
ok 1 number(s): "59715"
Test #90:
score: 0
Accepted
time: 0ms
memory: 3436kb
input:
473485219 377191656 294134518 76753
output:
0
result:
ok 1 number(s): "0"
Test #91:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
914529743 791997220 703750352 87959
output:
0
result:
ok 1 number(s): "0"
Test #92:
score: 0
Accepted
time: 19ms
memory: 3404kb
input:
287190763 864218981 637440224 113417
output:
104002
result:
ok 1 number(s): "104002"
Test #93:
score: 0
Accepted
time: 4ms
memory: 3404kb
input:
252187259 413365574 258758471 39827
output:
18554
result:
ok 1 number(s): "18554"
Test #94:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
713470139 654714169 466130648 199037
output:
0
result:
ok 1 number(s): "0"
Test #95:
score: 0
Accepted
time: 5ms
memory: 3512kb
input:
285199433 504207895 241554081 43789
output:
15318
result:
ok 1 number(s): "15318"
Test #96:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
48384463 135624661 130143471 18313
output:
0
result:
ok 1 number(s): "0"
Test #97:
score: 0
Accepted
time: 6ms
memory: 3336kb
input:
908666333 129596234 122414801 182201
output:
72533
result:
ok 1 number(s): "72533"
Test #98:
score: 0
Accepted
time: 8ms
memory: 3376kb
input:
276069377 833343734 362382755 98389
output:
42290
result:
ok 1 number(s): "42290"
Test #99:
score: 0
Accepted
time: 4ms
memory: 3412kb
input:
102486211 913873091 161874828 121609
output:
93558
result:
ok 1 number(s): "93558"
Test #100:
score: 0
Accepted
time: 1ms
memory: 3380kb
input:
301146641 332352910 94528493 9349
output:
2799
result:
ok 1 number(s): "2799"
Test #101:
score: 0
Accepted
time: 32ms
memory: 3436kb
input:
100108807 85649170 67659425 160169
output:
22262
result:
ok 1 number(s): "22262"
Test #102:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
779903647 619396431 185152629 17551
output:
0
result:
ok 1 number(s): "0"
Test #103:
score: 0
Accepted
time: 4ms
memory: 3504kb
input:
613172159 641540145 308022670 31379
output:
11007
result:
ok 1 number(s): "11007"
Test #104:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
387039113 156234173 3238532 93889
output:
0
result:
ok 1 number(s): "0"
Test #105:
score: 0
Accepted
time: 1ms
memory: 3408kb
input:
254624401 816634525 381080642 126601
output:
0
result:
ok 1 number(s): "0"
Test #106:
score: 0
Accepted
time: 7ms
memory: 3432kb
input:
180985993 845862927 585119095 36923
output:
15814
result:
ok 1 number(s): "15814"
Test #107:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
76915651 733524723 486981245 170801
output:
0
result:
ok 1 number(s): "0"
Test #108:
score: 0
Accepted
time: 1ms
memory: 3408kb
input:
580897411 795939972 58377331 151531
output:
0
result:
ok 1 number(s): "0"
Test #109:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
499492237 519311629 49150641 34381
output:
0
result:
ok 1 number(s): "0"
Test #110:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
758638469 373599410 242971082 193847
output:
0
result:
ok 1 number(s): "0"
Test #111:
score: 0
Accepted
time: 26ms
memory: 3440kb
input:
407399507 521923178 403466222 192239
output:
115241
result:
ok 1 number(s): "115241"
Test #112:
score: 0
Accepted
time: 14ms
memory: 3400kb
input:
541990247 385798793 203448892 189493
output:
106706
result:
ok 1 number(s): "106706"
Test #113:
score: 0
Accepted
time: 10ms
memory: 3516kb
input:
291343181 145991231 59717538 143617
output:
119061
result:
ok 1 number(s): "119061"
Test #114:
score: 0
Accepted
time: 25ms
memory: 3396kb
input:
737910599 163417254 34583342 114691
output:
110665
result:
ok 1 number(s): "110665"
Test #115:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
863177851 436915139 434891015 71597
output:
0
result:
ok 1 number(s): "0"
Test #116:
score: 0
Accepted
time: 4ms
memory: 3400kb
input:
901516513 317954642 48267571 65393
output:
54368
result:
ok 1 number(s): "54368"
Test #117:
score: 0
Accepted
time: 2ms
memory: 3512kb
input:
161715787 266239077 135050889 154369
output:
0
result:
ok 1 number(s): "0"
Test #118:
score: 0
Accepted
time: 3ms
memory: 3376kb
input:
166947173 801619656 762134796 46861
output:
7173
result:
ok 1 number(s): "7173"
Test #119:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
12736151 521705156 198148488 150379
output:
16929
result:
ok 1 number(s): "16929"
Test #120:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
680075881 481517731 251675865 69193
output:
0
result:
ok 1 number(s): "0"
Test #121:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
485850037 886511133 787950884 197521
output:
0
result:
ok 1 number(s): "0"
Test #122:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
177720407 517200970 148943056 9013
output:
0
result:
ok 1 number(s): "0"
Test #123:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
830566549 799522963 4422242 89603
output:
0
result:
ok 1 number(s): "0"
Test #124:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
392586269 310937504 78703669 191089
output:
0
result:
ok 1 number(s): "0"
Test #125:
score: 0
Accepted
time: 36ms
memory: 3400kb
input:
808223543 28745201 28319176 131933
output:
56603
result:
ok 1 number(s): "56603"
Test #126:
score: 0
Accepted
time: 24ms
memory: 3440kb
input:
34128239 315543426 68844789 183683
output:
112856
result:
ok 1 number(s): "112856"
Test #127:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
898717117 121776788 116705591 6733
output:
0
result:
ok 1 number(s): "0"
Test #128:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
224981191 155838434 27043260 111337
output:
0
result:
ok 1 number(s): "0"
Test #129:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
534799231 949123185 519638979 89137
output:
0
result:
ok 1 number(s): "0"
Test #130:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
118377569 480007092 237319996 98299
output:
0
result:
ok 1 number(s): "0"
Test #131:
score: 0
Accepted
time: 0ms
memory: 3400kb
input:
781196891 651621565 614686098 17863
output:
0
result:
ok 1 number(s): "0"
Test #132:
score: 0
Accepted
time: 37ms
memory: 3340kb
input:
26386807 844350770 832240953 162691
output:
19933
result:
ok 1 number(s): "19933"
Test #133:
score: 0
Accepted
time: 8ms
memory: 3412kb
input:
193338689 587320957 358733169 54167
output:
48273
result:
ok 1 number(s): "48273"
Test #134:
score: 0
Accepted
time: 4ms
memory: 3396kb
input:
108890003 705135636 478908389 18233
output:
0
result:
ok 1 number(s): "0"
Test #135:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
476740811 664071664 16321273 5669
output:
5190
result:
ok 1 number(s): "5190"
Test #136:
score: 0
Accepted
time: 3ms
memory: 3372kb
input:
768632861 658265356 430920465 100483
output:
38553
result:
ok 1 number(s): "38553"
Test #137:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
946534549 471040043 111057575 165799
output:
0
result:
ok 1 number(s): "0"
Test #138:
score: 0
Accepted
time: 0ms
memory: 3408kb
input:
90928081 712781968 83352461 86693
output:
0
result:
ok 1 number(s): "0"
Test #139:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
372868261 597288041 112006463 23911
output:
0
result:
ok 1 number(s): "0"
Test #140:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
618618331 17358907 3430255 23369
output:
0
result:
ok 1 number(s): "0"
Test #141:
score: 0
Accepted
time: 4ms
memory: 3400kb
input:
750850613 811031159 204736479 46049
output:
24276
result:
ok 1 number(s): "24276"
Test #142:
score: 0
Accepted
time: 8ms
memory: 3564kb
input:
5828237 841587707 385818661 130693
output:
23243
result:
ok 1 number(s): "23243"
Test #143:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
65502883 703524797 688036172 155921
output:
0
result:
ok 1 number(s): "0"
Test #144:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
804616039 974150257 735108434 26189
output:
0
result:
ok 1 number(s): "0"
Test #145:
score: 0
Accepted
time: 19ms
memory: 3404kb
input:
290703113 500581687 256178712 161093
output:
140843
result:
ok 1 number(s): "140843"
Test #146:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
980194207 809840406 642709945 2239
output:
0
result:
ok 1 number(s): "0"
Test #147:
score: 0
Accepted
time: 4ms
memory: 3560kb
input:
837060391 48188764 10488467 27947
output:
12970
result:
ok 1 number(s): "12970"
Test #148:
score: 0
Accepted
time: 5ms
memory: 3396kb
input:
72053873 439430330 197716438 115891
output:
81802
result:
ok 1 number(s): "81802"
Test #149:
score: 0
Accepted
time: 1ms
memory: 3372kb
input:
316381301 229806798 119935275 189961
output:
0
result:
ok 1 number(s): "0"
Test #150:
score: 0
Accepted
time: 2ms
memory: 3400kb
input:
80416381 574767068 334514385 148609
output:
0
result:
ok 1 number(s): "0"
Test #151:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
107739607 297842544 261855158 38953
output:
27938
result:
ok 1 number(s): "27938"
Test #152:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
194707309 77835564 52912510 20071
output:
0
result:
ok 1 number(s): "0"
Test #153:
score: 0
Accepted
time: 2ms
memory: 3412kb
input:
6103403 304794364 10079430 189019
output:
0
result:
ok 1 number(s): "0"
Test #154:
score: 0
Accepted
time: 4ms
memory: 3400kb
input:
707896513 827140296 607622195 86029
output:
22676
result:
ok 1 number(s): "22676"
Test #155:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
949345879 109406003 43024503 31687
output:
0
result:
ok 1 number(s): "0"
Test #156:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
309279067 782418208 90258155 4283
output:
0
result:
ok 1 number(s): "0"
Test #157:
score: 0
Accepted
time: 0ms
memory: 3444kb
input:
346119013 28265099 21750799 2791
output:
0
result:
ok 1 number(s): "0"
Test #158:
score: 0
Accepted
time: 15ms
memory: 3376kb
input:
715902461 339885839 18452995 67217
output:
48652
result:
ok 1 number(s): "48652"
Test #159:
score: 0
Accepted
time: 2ms
memory: 3440kb
input:
366268963 33894427 12694040 160159
output:
0
result:
ok 1 number(s): "0"
Test #160:
score: 0
Accepted
time: 11ms
memory: 3400kb
input:
781526197 735144675 107471311 88873
output:
83888
result:
ok 1 number(s): "83888"
Test #161:
score: 0
Accepted
time: 3ms
memory: 3440kb
input:
853674539 148529031 60503489 18749
output:
14468
result:
ok 1 number(s): "14468"
Test #162:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
974290403 460401644 259330095 167987
output:
0
result:
ok 1 number(s): "0"
Test #163:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
31693591 663637346 164730242 46591
output:
23708
result:
ok 1 number(s): "23708"
Test #164:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
426754619 782508257 359057937 23321
output:
0
result:
ok 1 number(s): "0"
Test #165:
score: 0
Accepted
time: 13ms
memory: 3396kb
input:
362439211 683827203 303588684 97169
output:
60673
result:
ok 1 number(s): "60673"
Test #166:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
634208671 99435775 92982385 164023
output:
0
result:
ok 1 number(s): "0"
Test #167:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
203883389 7956097 7640941 91909
output:
0
result:
ok 1 number(s): "0"
Test #168:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
544942579 862877357 538494739 166031
output:
0
result:
ok 1 number(s): "0"
Test #169:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
674546837 117898124 87767492 112097
output:
0
result:
ok 1 number(s): "0"
Test #170:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
296775823 906524629 59996880 104021
output:
0
result:
ok 1 number(s): "0"
Test #171:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
735446441 135789967 18054037 47431
output:
0
result:
ok 1 number(s): "0"
Test #172:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
334173263 200994361 109635511 25643
output:
0
result:
ok 1 number(s): "0"
Test #173:
score: 0
Accepted
time: 1ms
memory: 3376kb
input:
873635753 258703936 190066142 138403
output:
0
result:
ok 1 number(s): "0"
Test #174:
score: 0
Accepted
time: 3ms
memory: 3512kb
input:
567404941 464993956 380742495 89819
output:
39911
result:
ok 1 number(s): "39911"