QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#549104 | #3278. 算术 | le0n# | 48 | 2ms | 4076kb | C++14 | 1.1kb | 2024-09-06 08:44:57 | 2024-09-06 08:44:58 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int cnt;
ll pr[105];
ll qpow(ll x, ll y, ll z)
{
ll ans = 1;
while(y)
{
if(y & 1)
ans = (__int128)ans * x % z;
x = (__int128)x * x % z;
y >>= 1;
}
return ans;
}
ll gcd(ll x, ll y)
{
return x ? gcd(y % x, x) : y;
}
ll work(ll p)
{
int i;
ll q = p;
cnt = 0;
for(i = 2; i * i <= p; i++)
if(!(p % i))
{
q -= q / i;
pr[++cnt] = i;
while(!(p % i))
p /= i;
}
if(p > 1)
{
q -= q / p;
pr[++cnt] = p;
}
return q;
}
int main()
{
int T, i;
ll p, q, r, b;
scanf("%d%lld", &T, &p);
work(q = work(p));
while(T--)
{
scanf("%lld", &b);
if(gcd(p, b) != 1)
{
printf("-1\n");
continue;
}
if(p == 2)
{
printf("1\n");
continue;
}
r = q;
for(i = 1; i <= cnt; i++)
while(!(r % pr[i]) && qpow(b, r / pr[i], p) == 1)
r /= pr[i];
if(r & 1)
{
printf("-1\n");
continue;
}
r /= 2;
if(qpow(b, r, p) == p - 1)
printf("%lld\n", r - 1 + ((r == 1) << 1));
else
printf("-1\n");
}
return 0;
}
详细
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 1ms
memory: 4060kb
input:
10 3 10 7 13 4 17 28 29 13 4 30
output:
-1 -1 -1 -1 2 -1 2 -1 -1 -1
result:
ok 10 numbers
Test #2:
score: 5
Accepted
time: 0ms
memory: 3856kb
input:
10 3 17 21 29 8 25 21 8 14 26 7
output:
2 -1 2 2 -1 -1 2 2 2 -1
result:
ok 10 numbers
Test #3:
score: 5
Accepted
time: 0ms
memory: 3796kb
input:
10 2 14 12 20 12 7 4 6 12 16 13
output:
-1 -1 -1 -1 1 -1 -1 -1 -1 1
result:
ok 10 numbers
Subtask #2:
score: 5
Accepted
Dependency #1:
100%
Accepted
Test #4:
score: 5
Accepted
time: 0ms
memory: 4068kb
input:
10 4 10 10 39 26 20 30 23 13 17 27
output:
-1 -1 2 -1 -1 -1 2 -1 -1 2
result:
ok 10 numbers
Test #5:
score: 5
Accepted
time: 0ms
memory: 3776kb
input:
10 5 13 45 45 36 46 30 47 6 15 16
output:
1 -1 -1 -1 -1 -1 1 -1 -1 -1
result:
ok 10 numbers
Test #6:
score: 5
Accepted
time: 0ms
memory: 4060kb
input:
10 6 8 31 37 22 29 7 44 12 29 32
output:
-1 -1 -1 -1 2 -1 -1 -1 2 -1
result:
ok 10 numbers
Test #7:
score: 5
Accepted
time: 0ms
memory: 3864kb
input:
10 7 27 34 12 18 36 57 21 61 27 25
output:
2 2 2 -1 -1 -1 -1 2 2 -1
result:
ok 10 numbers
Test #8:
score: 5
Accepted
time: 0ms
memory: 3768kb
input:
10 8 36 58 52 78 43 42 51 40 18 27
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok 10 numbers
Test #9:
score: 5
Accepted
time: 0ms
memory: 4024kb
input:
10 9 53 26 68 54 24 81 29 13 71 71
output:
2 2 2 -1 -1 -1 2 -1 2 2
result:
ok 10 numbers
Test #10:
score: 5
Accepted
time: 0ms
memory: 4056kb
input:
10 10 67 43 20 39 55 51 47 62 87 100
output:
1 1 -1 2 -1 -1 1 -1 1 -1
result:
ok 10 numbers
Subtask #3:
score: 5
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #11:
score: 5
Accepted
time: 0ms
memory: 4064kb
input:
100 97 180 581 305 712 315 861 922 484 175 519 943 365 547 142 770 114 182 452 746 290 158 583 185 600 609 412 523 397 227 839 604 387 116 621 914 640 324 678 221 938 709 677 876 678 213 653 581 903 299 287 860 765 672 180 399 907 814 969 934 956 820 864 235 848 815 367 241 737 674 417 856 404 291 4...
output:
47 2 47 3 11 7 23 2 15 15 7 47 2 15 5 47 7 3 15 2 -1 -1 11 7 7 11 47 11 3 15 1 2 15 47 47 47 3 2 7 23 15 23 23 2 15 47 2 15 7 11 47 23 47 47 23 15 47 2 -1 47 23 11 47 23 47 47 3 47 47 47 47 5 -1 47 3 15 47 47 15 2 15 23 47 2 11 5 1 47 47 2 15 2 47 47 47 3 47 2 23 15
result:
ok 100 numbers
Test #12:
score: 5
Accepted
time: 0ms
memory: 3772kb
input:
100 91 851 144 363 247 607 696 363 691 883 394 118 371 360 787 879 868 168 103 842 706 414 746 540 702 217 817 497 573 822 395 108 384 551 620 436 374 340 907 855 181 849 661 580 707 726 513 749 636 812 454 874 227 472 315 791 806 752 909 188 690 664 547 657 153 138 171 587 419 430 731 349 512 904 7...
output:
-1 -1 2 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 2 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 2 -1 2 -1 -1 2 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1
result:
ok 100 numbers
Test #13:
score: 5
Accepted
time: 0ms
memory: 4068kb
input:
100 81 85 543 544 188 666 539 270 161 666 323 221 522 512 207 622 762 284 740 143 397 265 774 419 370 344 163 214 214 501 262 436 328 647 754 453 161 416 809 723 229 496 735 357 478 242 161 227 389 188 325 382 134 463 736 325 329 231 102 623 553 728 445 460 636 416 646 637 221 219 436 695 298 161 87...
output:
-1 -1 -1 2 -1 2 -1 2 -1 2 26 -1 2 -1 -1 -1 26 26 8 -1 -1 -1 26 -1 26 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 2 26 2 -1 -1 -1 -1 -1 -1 2 2 26 26 2 -1 -1 2 -1 -1 -1 26 -1 -1 26 -1 2 -1 -1 -1 26 -1 -1 26 -1 -1 26 -1 2 -1 8 2 -1 -1 2 -1 -1 -1 -1 -1 26 -1 2 -1 -1 26 -1 -1 26 -1 26 26 -1 2 -1 -1
result:
ok 100 numbers
Test #14:
score: 5
Accepted
time: 0ms
memory: 3764kb
input:
100 100 738 253 417 420 523 537 778 736 670 839 957 849 419 768 796 772 493 269 631 615 606 484 445 701 324 586 601 690 439 249 221 372 648 999 682 202 889 231 386 179 399 414 487 480 349 436 470 749 549 149 779 707 440 737 467 449 483 803 900 459 549 972 979 949 604 244 553 509 269 784 721 387 427 ...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 4 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1
result:
ok 100 numbers
Test #15:
score: 5
Accepted
time: 0ms
memory: 4020kb
input:
100 71 261 626 313 283 308 396 681 76 354 297 425 355 649 399 166 201 368 671 671 72 227 248 372 641 239 697 567 424 78 238 403 457 129 384 246 357 346 496 581 279 177 503 682 392 338 656 98 564 674 562 364 567 521 304 145 457 669 421 677 694 241 535 354 354 109 511 446 209 285 355 496 645 449 273 3...
output:
-1 -1 -1 2 -1 6 34 -1 2 34 2 -1 -1 34 -1 34 34 -1 -1 -1 4 34 4 -1 6 -1 2 34 34 -1 -1 34 -1 -1 34 -1 34 2 34 4 34 -1 -1 -1 -1 4 -1 34 34 34 -1 2 -1 -1 -1 34 -1 4 -1 34 34 -1 2 2 -1 4 -1 34 -1 -1 2 -1 6 -1 34 -1 -1 -1 34 6 34 34 6 34 -1 6 2 -1 4 -1 6 -1 6 34 4 34 34 -1 4 2
result:
ok 100 numbers
Test #16:
score: 5
Accepted
time: 0ms
memory: 3768kb
input:
100 91 405 173 240 151 729 826 614 533 292 878 272 184 613 170 632 215 836 320 437 240 837 612 243 527 492 762 818 734 139 166 355 228 790 419 808 365 181 254 277 884 683 174 546 870 170 280 818 624 596 701 483 854 421 638 766 885 634 361 634 242 519 902 834 316 558 392 710 791 719 570 465 667 599 8...
output:
-1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 2 2 -1 2 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 2 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1
result:
ok 100 numbers
Test #17:
score: 5
Accepted
time: 0ms
memory: 3852kb
input:
100 67 329 142 107 81 244 378 571 198 307 141 547 206 488 342 107 639 358 589 127 315 509 551 501 347 388 268 550 131 351 526 102 541 270 669 588 378 195 209 638 228 212 527 231 350 506 178 374 164 320 401 129 413 504 669 155 445 518 659 151 239 126 303 535 102 237 334 566 220 309 633 133 362 200 26...
output:
32 10 -1 -1 10 10 -1 -1 -1 32 32 10 -1 32 -1 -1 -1 10 -1 -1 -1 -1 32 32 10 -1 -1 -1 -1 32 -1 10 32 2 10 10 32 10 -1 10 32 10 2 -1 -1 32 -1 2 10 2 -1 32 -1 2 -1 10 -1 -1 -1 2 -1 -1 2 -1 -1 2 2 -1 32 2 2 10 2 2 32 10 2 -1 32 -1 2 2 10 32 2 10 -1 10 32 -1 -1 10 32 -1 32 2 32 10 32 -1
result:
ok 100 numbers
Test #18:
score: 5
Accepted
time: 0ms
memory: 3700kb
input:
100 50 437 346 112 103 466 381 454 423 206 353 166 74 357 58 479 480 372 303 99 325 180 490 341 56 425 169 359 450 200 99 199 299 432 324 339 328 419 72 322 86 247 51 277 455 71 239 380 438 448 158 293 246 489 58 251 460 109 399 172 350 123 425 456 118 199 246 139 199 221 425 440 475 142 450 257 349...
output:
9 -1 -1 9 -1 -1 -1 9 -1 9 -1 -1 1 -1 4 -1 -1 9 2 -1 -1 -1 -1 -1 -1 4 4 -1 -1 2 2 2 -1 -1 4 -1 4 -1 -1 -1 9 -1 9 -1 -1 4 -1 -1 -1 -1 1 -1 4 -1 -1 -1 4 2 -1 -1 9 -1 -1 -1 2 -1 4 2 -1 -1 -1 -1 -1 -1 1 2 2 4 -1 4 9 -1 2 -1 9 -1 -1 -1 9 -1 9 -1 2 4 -1 -1 9 1 -1 -1
result:
ok 100 numbers
Test #19:
score: 5
Accepted
time: 0ms
memory: 3772kb
input:
100 24 180 159 233 75 236 31 147 81 175 180 119 117 79 175 204 182 137 123 36 127 132 125 175 239 128 188 240 32 139 105 175 183 171 107 56 206 58 125 95 182 33 49 215 135 62 223 77 199 145 65 103 125 214 154 87 47 29 175 52 178 92 150 31 32 209 134 220 92 217 74 35 223 128 215 234 127 239 112 141 6...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok 100 numbers
Subtask #4:
score: 11
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #20:
score: 11
Accepted
time: 0ms
memory: 3792kb
input:
100 6007 47209 17765 12070 33936 9456 46389 53980 47081 33569 12604 9471 53986 30034 23277 45832 42538 42048 16651 8020 57713 18099 10847 36498 53379 48899 46111 27949 35995 19980 36681 43053 30147 13279 42048 54141 14304 22364 24027 47979 45448 8046 46884 34366 44206 42127 49959 27880 37359 17772 3...
output:
-1 1000 3002 3002 272 -1 -1 -1 3002 -1 3002 2 2 1000 -1 1000 2 3002 230 1000 2 76 3002 3002 1000 12 -1 3002 76 3002 -1 428 272 2 2 230 90 2 2 32 3002 -1 -1 3002 2 -1 -1 428 1000 2 -1 -1 -1 428 1000 3002 -1 -1 2 -1 3002 1000 -1 -1 1000 3002 1000 -1 3002 -1 -1 3002 -1 -1 3002 76 -1 2 -1 3002 1000 -1 -...
result:
ok 100 numbers
Test #21:
score: 11
Accepted
time: 0ms
memory: 3772kb
input:
100 4051 8389 31611 11594 12817 33649 7172 26030 7466 8694 10490 4761 17984 17340 10129 38474 14225 31740 30259 32111 33089 27227 28415 6946 12349 7420 9073 32082 36458 32201 18875 13076 19473 17013 37823 13577 16711 4649 23061 26207 27875 15180 21335 10917 7084 30956 16203 7707 6450 14670 7951 1721...
output:
-1 2 2024 674 14 2024 -1 44 404 134 -1 2024 674 -1 2024 -1 2024 -1 74 -1 2024 2024 2024 -1 74 404 -1 2 -1 674 -1 -1 674 74 2024 2024 2024 -1 404 2024 4 -1 2024 -1 -1 2 -1 404 2024 -1 674 -1 2024 674 -1 2 2024 2024 -1 -1 80 2 2 2024 -1 -1 2024 2 404 2024 2024 2 -1 224 2024 2024 2024 -1 -1 -1 74 2024 ...
result:
ok 100 numbers
Test #22:
score: 11
Accepted
time: 0ms
memory: 4024kb
input:
100 9323 15509 64805 9567 78745 68708 83906 38816 82251 19294 18197 16917 66211 21706 24188 62893 35932 67872 23904 69166 43685 52836 82840 58824 65466 34882 72563 54038 64098 22473 15338 66018 38785 34483 59422 61403 33509 22947 47635 71422 29273 18645 25141 63196 26208 64199 46614 86896 34049 6128...
output:
-1 -1 4660 4660 -1 2 4660 4660 4660 4660 -1 4660 -1 -1 78 4660 78 -1 4660 4660 4660 4660 -1 4660 -1 4660 4660 4660 4660 4660 -1 -1 4660 -1 4660 -1 -1 -1 4660 4660 2 4660 4660 -1 4660 2 58 4660 -1 -1 4660 4660 -1 4660 4660 2 4660 78 -1 -1 4660 -1 -1 -1 -1 4660 4660 -1 -1 4660 2 4660 4660 4660 -1 4660...
result:
ok 100 numbers
Test #23:
score: 11
Accepted
time: 0ms
memory: 3864kb
input:
100 8280 71879 23524 17600 51841 13733 36730 17103 75017 31999 35727 69190 72656 28447 9974 25960 69762 62416 76743 27773 46635 56719 54711 46264 46757 31392 53859 27856 31928 52586 70471 18092 25217 25832 12140 60872 71114 23369 17479 30580 70472 72974 35126 58879 31688 16559 17801 79266 52471 4044...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 32 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok 100 numbers
Test #24:
score: 11
Accepted
time: 0ms
memory: 3752kb
input:
100 8633 60430 10480 80513 83117 67906 46501 32354 26204 49326 41990 50727 62145 81183 29273 55670 78867 75581 17937 81612 69528 83551 42551 50586 29030 61423 10770 26151 20132 55575 77777 66256 23652 69887 25681 36638 74155 26147 61308 50210 17265 46745 83050 11699 38357 80577 47044 44634 66132 705...
output:
2 -1 -1 -1 -1 -1 -1 -1 -1 -1 131 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 131 131 -1 2 -1 -1 -1 -1 -1 -1 -1 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 131 -1 -1 -1 -1 -1 -1 -1 -1 -1 21 -1 -1 -1 -1 43 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 131 -1 -1 -1 -1
result:
ok 100 numbers
Test #25:
score: 11
Accepted
time: 0ms
memory: 3768kb
input:
100 1875 15679 16586 6272 11545 14154 11282 15493 7847 18568 4598 8478 11768 16436 15352 9091 14374 13265 14897 14270 1920 14276 7011 6582 10208 8432 18251 5856 11275 10003 18124 14074 6642 7945 18271 4581 5518 9117 7164 9810 17960 12619 14093 17756 11327 8702 3496 15221 8502 10143 6183 5729 11911 2...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 124 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 124 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 124 -1 -1
result:
ok 100 numbers
Test #26:
score: 11
Accepted
time: 0ms
memory: 3728kb
input:
100 359 443 2987 2153 3063 1307 1588 795 2153 2512 2591 524 2694 1893 2730 3485 1077 2807 3038 2904 2269 1773 1341 1482 717 2477 1831 900 985 1435 1076 3304 1045 1746 1076 1176 3563 2931 899 2084 1038 444 976 3379 1435 572 3234 2750 936 801 2601 2047 716 3270 866 1360 2022 379 3196 1804 963 3230 199...
output:
178 -1 2 -1 -1 178 178 2 2 178 -1 -1 -1 -1 -1 -1 -1 178 -1 -1 178 -1 -1 2 178 -1 -1 178 2 2 -1 178 178 2 -1 178 178 -1 -1 -1 -1 178 -1 2 178 -1 -1 178 178 -1 178 178 178 -1 -1 178 -1 -1 -1 -1 2 -1 2 2 -1 -1 178 2 -1 -1 178 2 -1 178 178 178 178 178 -1 178 -1 -1 -1 178 -1 2 -1 178 178 178 2 -1 178 -1 ...
result:
ok 100 numbers
Test #27:
score: 11
Accepted
time: 0ms
memory: 3768kb
input:
100 6973 50532 67580 25240 33029 50583 10822 34495 41837 40773 40179 20901 49720 41837 44264 64287 64960 44010 28573 22717 52205 47391 29408 20424 26758 67060 32920 53581 47349 22979 46108 66098 25603 8976 8686 52270 20003 16149 65989 23187 66906 60114 18119 40683 67021 11027 22187 61716 25430 66530...
output:
-1 -1 2 -1 -1 -1 -1 2 -1 548 -1 -1 2 -1 -1 -1 -1 -1 182 -1 -1 548 182 -1 -1 182 -1 -1 -1 548 -1 548 182 548 -1 548 -1 -1 -1 -1 -1 182 -1 -1 -1 548 -1 -1 -1 -1 548 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 182 -1 -1 182 182 60 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 182 -1 -1 -1 -1 -1 548 182 18...
result:
ok 100 numbers
Test #28:
score: 11
Accepted
time: 0ms
memory: 3864kb
input:
100 7489 11286 72696 34199 47402 53224 14096 64001 38566 44544 57454 74889 37269 26930 41362 41230 42424 43515 61221 68174 68262 35058 8030 20659 62087 14962 34368 62824 38218 64126 61521 25171 41679 44197 73007 18633 40348 39008 50920 37797 59911 28408 47024 23582 56987 63187 8393 70496 70084 52775...
output:
1247 143 1247 2 3743 1871 1871 233 1871 1247 2 1871 1247 3743 155 3743 3743 415 3 935 3743 3743 935 623 116 1247 3743 3 3743 103 11 3743 415 3743 3743 935 3743 467 15 2 3743 3743 -1 467 3743 935 935 1247 15 287 935 1247 51 415 3743 1247 2 1247 3743 3743 311 3743 3743 103 3743 935 1871 116 935 287 15...
result:
ok 100 numbers
Test #29:
score: 11
Accepted
time: 0ms
memory: 3768kb
input:
100 3937 10264 30561 27656 9016 17800 9056 36272 23767 32404 26071 18011 22166 24538 16184 26093 7872 30456 28053 4980 4713 13936 36679 31485 38397 10876 7132 4139 12467 33711 4044 22369 15590 11318 31818 33162 19412 19938 14040 27031 30100 8911 28719 9762 15544 19864 8586 36326 11811 12911 38335 30...
output:
-1 -1 -1 2 2 -1 -1 -1 -1 -1 -1 -1 104 -1 314 34 -1 -1 -1 -1 314 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 104 2 -1 -1 20 -1 20 104 -1 -1 314 -1 -1 -1 2 62 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 8 -1 -1 -1 -1
result:
ok 100 numbers
Subtask #5:
score: 11
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #30:
score: 11
Accepted
time: 1ms
memory: 4024kb
input:
100 870871 4340793 1243207 5051375 6213833 4858829 5468093 1895983 4716622 4329188 7326127 7032179 1732301 4515071 3496892 7006275 3559934 4552910 6966967 2034005 6050959 4863305 1122074 2063870 7741800 6492441 6966967 2658328 3291177 6528485 7290647 7692269 3278193 1657513 7526455 6977925 5565770 8...
output:
87086 435434 -1 435434 145144 -1 -1 -1 39584 435434 435434 435434 -1 145144 87086 -1 -1 2 -1 29028 87086 -1 29028 -1 4 2 145144 -1 87086 435434 87086 435434 -1 194 145144 435434 -1 -1 20734 87086 -1 -1 33494 435434 -1 -1 -1 7916 -1 145144 -1 6 435434 5004 -1 435434 -1 145144 -1 435434 145144 62204 -...
result:
ok 100 numbers
Test #31:
score: 11
Accepted
time: 0ms
memory: 3868kb
input:
100 496127 3431032 3472888 3945186 1493043 1496080 2441793 4340777 3969015 3564483 1909667 3969015 811931 947407 540410 1396895 4283602 2976761 3797658 1247618 3081930 580053 1373312 4608769 4696255 4062513 992253 3971185 4754046 4824823 696150 4447444 4554584 2420120 3472888 2394828 4542622 2480634...
output:
-1 2 -1 -1 -1 -1 248062 2 248062 248062 2 248062 -1 -1 248062 248062 2 248062 248062 248062 -1 248062 -1 -1 248062 2 248062 -1 248062 -1 248062 -1 248062 2 -1 -1 2 248062 -1 2 -1 248062 248062 248062 248062 248062 248062 248062 248062 -1 248062 248062 -1 -1 -1 248062 2 248062 2 248062 -1 -1 248062 2...
result:
ok 100 numbers
Test #32:
score: 11
Accepted
time: 0ms
memory: 3796kb
input:
100 425251 1736642 929887 1859381 1195224 3611852 1575702 1050696 1600241 2167711 2470461 3111388 3018847 2099864 2041919 1984318 2699726 3032971 3432337 2861462 446148 2156584 682413 3469229 765854 4183989 3192591 1264854 3623955 440986 2144858 2003321 3062898 2832430 4137778 1923175 630308 3257053...
output:
-1 212624 14174 212624 14174 -1 212624 42524 4724 42524 212624 70874 -1 70874 70874 -1 -1 2 212624 -1 2 -1 23624 30374 -1 -1 212624 4 -1 14174 3374 14174 -1 212624 3374 10124 -1 -1 4 70874 -1 -1 14174 70874 70874 -1 -1 -1 -1 224 -1 2 -1 -1 -1 -1 70874 8504 -1 30374 212624 -1 -1 -1 -1 14 374 212624 2...
result:
ok 100 numbers
Test #33:
score: 11
Accepted
time: 0ms
memory: 3852kb
input:
100 1000000 6597220 5049546 5930742 4317480 9218751 5992493 8915356 5754068 8218751 9546902 9182545 2941655 3951785 6639465 2999999 2253465 1218751 1644989 5864267 2077662 3566443 9176929 2533032 7218751 9066747 1157461 7555220 5200699 2599999 3410828 3888820 1004579 4947717 8284018 4768622 9253205 ...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 3124 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 624 -1
result:
ok 100 numbers
Test #34:
score: 11
Accepted
time: 1ms
memory: 4024kb
input:
100 988027 1837394 3299469 1545726 9770903 3293092 1029808 2503299 4250480 5446768 1172665 6978730 5894487 9196883 9597179 8032599 1748490 9762707 6119585 7241459 4293190 7804961 3955271 8691374 4212647 9148268 4501023 5162890 2546971 9326753 6175001 9221254 3902797 8427257 8287677 2425264 9760871 2...
output:
-1 -1 -1 -1 -1 41084 -1 -1 -1 41084 41084 -1 -1 -1 -1 -1 41084 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 41084 -1 -1 -1 41084 2 2738 -1 -1 -1 41084 -1 -1 -1 -1 -1 -1 2 -1 41084 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 8216 -1 -1 2 41084 -1 8216 -1 -1 -1 -1 -1 -1 -1 41084 -1 -1 ...
result:
ok 100 numbers
Test #35:
score: 11
Accepted
time: 0ms
memory: 3724kb
input:
100 768337 6170303 7683369 3030059 6891269 3261155 7072331 2789839 3073347 3399682 7532266 1947827 7428207 2800663 7642033 4063251 2136377 7273587 5442579 4682564 7528601 1347723 3741381 2064886 5105587 4205261 5035584 2650573 3097112 3867686 1583291 5647819 2011963 5723425 4467023 7372225 6990952 4...
output:
2936 2 -1 -1 -1 -1 -1 2 -1 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3915 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 11747 -1 -1 -1 1067 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3915 355 -1 88 11747 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 100 numbers
Test #36:
score: 11
Accepted
time: 0ms
memory: 3792kb
input:
100 41127 183500 402403 312225 293309 284980 64387 314722 61050 242933 377694 174978 125779 328862 54850 53065 236129 332135 273974 155158 189016 190589 95962 109704 311075 293405 151808 352098 175493 304394 76107 239147 371109 134874 271076 95986 202326 356435 110332 338524 393994 209517 333738 197...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3426 -1 -1 -1 -1 -1 -1 -1 3426 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3426 -1 -1 -1 3426 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3426 -1 -1 -1 -1 -1 22 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 342...
result:
ok 100 numbers
Test #37:
score: 11
Accepted
time: 0ms
memory: 3868kb
input:
100 814811 4702891 8148109 7265719 2996892 1878042 5242279 6192048 1720249 3612657 921380 4074054 8138238 6387697 964450 4598391 6143799 6650496 7172748 6233339 1576510 7969074 5712340 4227149 3487165 5242654 3553929 5297156 4829431 4612306 5592093 1206536 1964012 6014474 5350872 7111504 8142765 538...
output:
-1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 50306 -1 -1 2 -1 -1 16768 -1 -1 -1 16768 2 -1 -1 -1 -1 -1 -1 50306 -1 -1 50306 -1 -1 -1 -1 -1 -1 16768 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
result:
ok 100 numbers
Test #38:
score: 11
Accepted
time: 0ms
memory: 3776kb
input:
100 980069 5031257 1623836 5606410 3171158 9198845 1292726 1595200 5160078 6883253 2202438 9206094 7360809 7991006 2839279 7840551 8122593 7457776 8258759 3045416 3721463 6781647 9099024 6897523 997549 2281818 6347842 9538642 1444442 8496247 1430979 1715406 1673856 7527227 8771540 4000844 5451366 74...
output:
245016 -1 245016 490033 490033 -1 490033 490033 88 245016 -1 -1 -1 490033 2 245016 -1 490033 490033 -1 490033 490033 245016 490033 490033 490033 -1 -1 245016 245016 490033 88 245016 -1 245016 -1 490033 490033 490033 245016 490033 490033 245016 245016 490033 490033 490033 2752 245016 245016 245016 55...
result:
ok 100 numbers
Test #39:
score: 11
Accepted
time: 0ms
memory: 3796kb
input:
100 482854 4480398 4711451 3356670 931320 496442 2741124 3260240 4621549 2271194 2626299 2369907 4023932 1923181 1262147 4203788 3106792 4815403 2389176 3807290 3438221 3709689 2659162 3055157 1448561 779444 3374692 3598884 1831598 4686446 2410188 3837985 3110321 2814793 3116595 3619038 3493594 1538...
output:
-1 1994 -1 -1 -1 -1 -1 -1 -1 1994 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 1994 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 29924 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 299...
result:
ok 100 numbers
Subtask #6:
score: 11
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Test #40:
score: 11
Accepted
time: 2ms
memory: 4076kb
input:
1000 14804791 114016904 121184339 75210853 42958826 138955816 68574265 72970819 144709979 77262866 70792973 133638083 137672425 57493003 54397275 105847169 77366725 125834385 94267625 42694999 54812532 119224592 72719688 19168765 78672961 132656140 93972732 68588344 128284760 49714725 124752071 3731...
output:
7402394 7402394 -1 7916 4 2467464 -1 1057484 1057484 -1 224314 -1 1057484 -1 569414 -1 2467464 7402394 1057484 6 1057484 -1 -1 7402394 2467464 1057484 -1 569414 51764 -1 -1 7402394 -1 12 -1 -1 -1 -1 2467464 -1 7402394 2 211496 -1 569414 -1 -1 96134 -1 -1 2467464 224314 -1 -1 -1 -1 -1 1057484 376 464...
result:
ok 1000 numbers
Test #41:
score: 11
Accepted
time: 1ms
memory: 3728kb
input:
1000 100000000 892193085 814218751 428160882 234701783 452377635 901211602 246381989 653058049 239419363 897141085 423412510 119999999 147137651 914218751 268753168 924057373 592519983 659629202 959009839 242251162 231080539 549417126 917454439 995729894 516819433 398030620 406135890 663137939 75130...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 2 -1 -1 4 -1 -1 -1 -1 24 -1 -1 -1 -1 -1 -1 -1 -1 -1 78124 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
result:
ok 1000 numbers
Test #42:
score: 11
Accepted
time: 0ms
memory: 3772kb
input:
1000 52671583 135715916 283593674 133006769 427747134 427747134 219513982 118469618 149797877 243509811 445095423 504275947 488655654 306866110 483185501 218788729 258723459 504539166 485874910 260763804 493868110 175970668 232783859 516686802 372909891 279995987 174904463 502693525 117611640 158589...
output:
-1 8778596 -1 2 2 -1 8778596 26335790 -1 -1 -1 -1 8778596 -1 -1 -1 8778596 -1 -1 26335790 26335790 -1 -1 -1 26335790 -1 26335790 26335790 26335790 -1 -1 -1 8778596 -1 26335790 8778596 -1 8778596 271502 8778596 290 -1 8778596 -1 -1 -1 26335790 271502 26335790 -1 -1 -1 -1 2 30166 8778596 -1 2926198 -1...
result:
ok 1000 numbers
Test #43:
score: 11
Accepted
time: 1ms
memory: 4056kb
input:
1000 43046721 53859960 251563433 344373767 291666395 228292899 101417166 353762673 190004768 62813283 53957529 86093441 401769395 334828524 286978139 358722674 164260632 70099200 279314845 129387442 261718183 120469513 82713901 278986283 115200953 100950424 85852142 148681986 373071581 85715747 2879...
output:
-1 14348906 2 14348906 -1 -1 -1 4782968 -1 -1 2 2 -1 2 2 -1 -1 -1 -1 -1 -1 -1 4782968 59048 -1 59048 -1 2 4782968 -1 2 -1 531440 14348906 -1 14348906 4782968 14348906 -1 14348906 -1 2 -1 1594322 -1 -1 -1 -1 -1 2 -1 -1 6560 4782968 59048 14348906 4782968 14348906 14348906 -1 2 -1 -1 -1 -1 14348906 14...
result:
ok 1000 numbers
Test #44:
score: 11
Accepted
time: 1ms
memory: 3724kb
input:
1000 24137569 198049843 79684818 86935614 113110119 63987607 149525189 213729145 86552479 192710440 190964054 185100960 129055074 217238120 172392303 66108682 209736929 225051508 160946092 168572871 52117103 48275137 78744583 116302707 189249653 75903812 226259321 203043461 202750388 34736161 100121...
output:
2839713 2839713 11358855 11358855 5679427 11358855 11358855 7 1 11358855 2839713 1419856 2 11358855 -1 11358855 -1 11358855 1 288 2 11358855 11358855 5679427 5679427 668167 -1 11358855 11358855 11358855 3 11358855 11358855 11358855 2839713 2839713 11358855 1419856 7 11358855 -1 2839713 5679427 11358...
result:
ok 1000 numbers
Test #45:
score: 11
Accepted
time: 2ms
memory: 3800kb
input:
1000 98189467 454566077 238753495 311746681 529821850 144396274 197442890 860177821 751378371 554142770 564679328 814966340 141993469 455013977 485998926 723909821 556944761 960466815 777900567 531245309 381897317 711954290 854351297 710705728 646762329 489715971 511526408 640912938 402443359 885879...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1626 -1 -1 1774 -1 2887924 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 577584 -1 354 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 2 -1 -1 -1 -1 2887924 -1 -1 -1 -1 -...
result:
ok 1000 numbers
Test #46:
score: 11
Accepted
time: 2ms
memory: 3860kb
input:
1000 99400891 120598085 167941257 530134762 637982513 960878603 182445173 737536775 418228164 524641908 373830739 958715241 671632383 928256679 671601264 193163713 599894866 281961106 484197553 331848172 313025638 155154239 979665962 533973520 684378005 579298168 985975659 818353887 631726222 223841...
output:
-1 -1 -1 -1 -1 1380290 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 460096 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1380290 -1 4140872 -1 -1 4140872 -1 -1 4140872 -1 -1 4140872 -1 -1 -1 -1 -1 -1 -1 -1 13802...
result:
ok 1000 numbers
Test #47:
score: 11
Accepted
time: 1ms
memory: 4068kb
input:
1000 81477582 771277123 563621033 506502979 763465588 87490714 384517229 537903672 761805868 413386942 287931443 460458267 299769292 737487421 459540743 291058414 467056788 679795600 291431386 247477976 492706511 214929688 282181952 796013522 531165055 567728046 169442368 101147055 249898981 9861600...
output:
-1 3394898 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3394898 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok 1000 numbers
Test #48:
score: 11
Accepted
time: 2ms
memory: 3776kb
input:
1000 84763673 421918097 477383756 335514096 243559321 431617172 768567225 172514001 167899744 293739530 504779234 384233901 576900997 360074854 241828569 246070545 625514488 687122759 742781168 155582425 814959451 582328432 560792357 833254909 694329051 789793092 609192930 591421423 389121446 845262...
output:
-1 -1 -1 375059 -1 -1 -1 -1 13 -1 -1 75011 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 125019 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1315 -1 -1 -1 -1 -1 -1 -1 12501 -1 -1 -1 -1 -1 46 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 75011 375059 -1 -1 -1 -1 -1 375059 281 -1 -1 125019 -1 -1 -1 -1 -...
result:
ok 1000 numbers
Subtask #7:
score: 0
Time Limit Exceeded
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Test #49:
score: 11
Accepted
time: 2ms
memory: 3768kb
input:
1000 10000000000 55723322369 14671653694 15574218751 53916062087 30128313962 62949851941 17634486244 76246218751 44081325384 70279778184 55049264364 43195767289 12699640452 63574218751 96091531560 31130570751 42645835885 47999999999 33574218751 70565204223 83921845249 99999999999 40453476405 3139840...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3124 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 3124 -1 -1 -1 -1 -1 24 -...
result:
ok 1000 numbers
Test #50:
score: 0
Time Limit Exceeded
input:
1000 6915878971 65594018119 52245181032 20404249873 40788243120 40845542073 35760759754 36487748798 34325278370 58678236680 36681815590 12098813309 51464183195 23494027346 14482836695 52175983464 49104115124 34541297756 62303183215 22313239811 27136076922 47876243513 12374277733 36884023726 48065943...
output:
result:
Subtask #8:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Dependency #7:
0%
Subtask #9:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Dependency #7:
0%
Subtask #10:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Dependency #7:
0%