QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#167690 | #6409. Classical Data Structure Problem | realIyxiang# | AC ✓ | 2812ms | 41032kb | C++14 | 3.0kb | 2023-09-07 16:37:45 | 2023-09-07 16:37:47 |
Judging History
answer
#include <cstdio>
#include <random>
#include <iostream>
#include <algorithm>
using namespace std;
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define pr pair <int, int>
#define rep(i, l, r) for (int i = l; i <= r; ++i)
const int N = 2e6 + 5;
const int P = (1 << 30);
int n, m, l, r, ans;
mt19937 rng(time(NULL));
int inc (int a, int b) { return (a += b) >= P ? a - P : a; }
int mul (int a, int b) { return 1ll * a * b % P; }
namespace FHQ {
#define ls t[p].l
#define rs t[p].r
struct node { int l, r, v, s, sl, sr, sz, num, tga; } t[N];
int rt, cnt;
void reset (int m) {
rep(i, 1, cnt) t[i].l = t[i].r = t[i].sl = t[i].sr = t[i].s = t[i].tga = 0;
t[rt = cnt = 1] = (node){0, 0, 0, 0, 0, (1 << m) - 1, 1 << m, 1, 0};
}
void pushup (int p) {
t[p].num = t[ls].num + t[rs].num + 1;
t[p].sz = t[ls].sz + t[rs].sz + t[p].sr - t[p].sl + 1;
t[p].s = inc(inc(t[ls].s, t[rs].s), mul(t[p].v, t[p].sr - t[p].sl + 1));
}
void lazy (int p, int k) {
t[p].s = inc(t[p].s, mul(t[p].sz, k));
t[p].v = inc(t[p].v, k);
t[p].tga = inc(t[p].tga, k);
}
void down (int p) {
if(t[p].tga) lazy(ls, t[p].tga), lazy(rs, t[p].tga);
t[p].tga = 0;
}
pr Split (int p, int k) {
if(!p) return mp(0, 0);
down(p);
if(t[p].sl <= k) {
pr o = Split(rs, k); rs = o.fi;
pushup(p); return mp(p, o.se);
} else {
pr o = Split(ls, k); ls = o.se;
pushup(p); return mp(o.fi, p);
}
}
int Merge (int p, int k) {
if(!p || !k) return p | k;
down(p), down(k);
if(rng() % (t[p].num + t[k].num) < t[p].num) {
rs = Merge(rs, k), pushup(p);
return p;
} else {
t[k].l = Merge(p, t[k].l), pushup(k);
return k;
}
}
int find (int k) {
int p = rt, ans = 0;
while (p) {
down(p);
if(t[p].sl <= k) ans = p, p = rs;
else p = ls;
}
return ans;
}
void add (int l) {
int pl = find(l);
if(t[pl].sl != l) {
pr o1 = Split(rt, t[pl].sl - 1), o2 = Split(o1.se, t[pl].sl);
t[++cnt] = (node){0, 0, t[pl].v, mul(t[pl].v, l - t[pl].sl), t[pl].sl, l - 1, l - t[pl].sl, 1, 0};
t[pl].sl = l, t[pl].sz = t[pl].r - l + 1, t[pl].s = mul(t[pl].v, t[pl].sz);
rt = Merge(o1.fi, cnt);
rt = Merge(rt, pl);
rt = Merge(rt, o2.se);
}
}
int update (int l, int r, int v) {
add(l);
if(r != (1 << m) - 1) add(r + 1);
pr o1 = Split(rt, l - 1), o2 = Split(o1.se, r);
lazy(o2.fi, v); int ans = t[o2.fi].s;
rt = Merge(o1.fi, o2.fi);
rt = Merge(rt, o2.se);
return ans;
}
}
int main () {
ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n >> m;
FHQ :: reset(m);
rep(i, 1, n) {
cin >> l >> r;
l = (l + ans) % (1 << m), r = (r + ans) % (1 << m);
if(l > r) swap(l, r);
ans = inc(ans, FHQ :: update(l, r, i));
}
cout << ans << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3712kb
input:
5 2 2 1 1 3 3 2 1 0 0 2
output:
87
result:
ok 1 number(s): "87"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
1 1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
1 2 3 1
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
1 5 31 15
output:
17
result:
ok 1 number(s): "17"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
1 20 366738 218765
output:
147974
result:
ok 1 number(s): "147974"
Test #6:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
1 30 86669484 41969116
output:
44700369
result:
ok 1 number(s): "44700369"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
10 5 20 31 2 2 14 18 13 25 26 4 22 9 15 9 19 16 15 27 9 20
output:
1414
result:
ok 1 number(s): "1414"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
100 10 245 987 817 813 743 560 548 504 116 479 223 199 775 998 126 542 791 823 96 318 69 349 0 584 245 601 119 513 93 820 115 307 838 978 249 767 433 287 240 8 22 683 169 720 395 592 903 866 919 652 510 563 858 345 938 250 550 239 981 7 784 926 212 644 272 365 490 871 470 987 571 53 65 593 515 370 1...
output:
20383734
result:
ok 1 number(s): "20383734"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
1000 1 0 1 1 0 1 0 1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 1 0 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 1 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 1 1 0 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 1 1 1 1 1...
output:
190098735
result:
ok 1 number(s): "190098735"
Test #10:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
1000 5 8 18 31 28 19 3 15 28 5 22 19 1 26 27 17 17 5 26 6 27 10 6 5 2 3 19 6 6 28 16 17 16 0 21 7 31 13 25 13 10 28 30 0 13 21 5 2 9 25 28 4 18 31 13 1 26 30 3 5 8 19 16 22 10 15 17 3 25 6 27 18 26 27 1 26 29 18 21 14 20 5 1 26 9 7 13 19 25 15 11 24 17 12 28 24 17 4 27 20 27 31 18 25 17 1 28 5 0 16 ...
output:
794181769
result:
ok 1 number(s): "794181769"
Test #11:
score: 0
Accepted
time: 2ms
memory: 3808kb
input:
1000 10 732 399 190 578 491 867 330 55 113 400 34 734 790 927 201 156 107 359 790 398 401 523 634 505 570 305 281 513 551 35 610 33 231 330 833 756 213 444 412 315 139 165 533 21 35 977 319 884 894 72 149 667 16 538 282 860 850 550 100 99 801 138 159 34 468 852 840 853 368 994 469 906 393 298 464 89...
output:
755182648
result:
ok 1 number(s): "755182648"
Test #12:
score: 0
Accepted
time: 14ms
memory: 4024kb
input:
5000 15 7705 10737 21186 31441 10307 825 19372 1969 32358 6343 22487 31897 12802 25210 17920 4297 5726 8409 28174 12489 16532 12646 9916 14917 19592 26927 23987 9279 26951 31081 3673 10505 20727 10730 28961 26581 11005 29624 13931 32180 29764 19108 23553 28977 30178 6537 25586 3041 15333 31927 4671 ...
output:
374742544
result:
ok 1 number(s): "374742544"
Test #13:
score: 0
Accepted
time: 30ms
memory: 6132kb
input:
10000 20 914013 637387 162942 785196 55799 893293 359726 714014 109456 559963 689320 161360 164737 25370 260018 436870 801394 34900 564741 620583 1008448 956143 788249 695007 633673 1020122 431990 397822 253241 746513 322933 927863 843120 378180 343689 583409 788822 249760 839003 753443 910418 20908...
output:
719391110
result:
ok 1 number(s): "719391110"
Test #14:
score: 0
Accepted
time: 444ms
memory: 10980kb
input:
100000 30 1063412225 224331901 116583527 514118426 121269548 678461017 856756753 250958443 1064104926 412721149 829078609 544244155 734000135 742933979 9127283 962205064 595091107 123655320 593251579 687018764 1052215261 661849950 297391487 243419322 105274358 526149321 1069300711 46673358 208918023...
output:
252791218
result:
ok 1 number(s): "252791218"
Test #15:
score: 0
Accepted
time: 977ms
memory: 18576kb
input:
200000 30 340892656 331749003 569148929 1001014926 169562315 65082998 783728999 371358574 1068579249 78668714 697845492 972638257 499257742 966955403 924540097 249425391 76210210 270676008 1055790206 117898225 186726707 639941146 774774929 469533012 608214477 15295274 30556605 466457599 892407954 78...
output:
220823398
result:
ok 1 number(s): "220823398"
Test #16:
score: 0
Accepted
time: 1554ms
memory: 25040kb
input:
300000 30 692114910 439166105 1021714331 414169601 217855081 525446803 710701245 491758705 1073053571 818358104 566612376 327290534 264515348 117235003 766211086 610387541 631071137 417696697 444587009 622519510 394979978 618032341 178416548 695646703 37412772 578183052 65554323 886241839 502156061 ...
output:
501248752
result:
ok 1 number(s): "501248752"
Test #17:
score: 0
Accepted
time: 2167ms
memory: 31928kb
input:
400000 30 1043337164 546583208 400537910 901066101 266147848 985810608 637673490 612158836 3786069 484305669 435379259 755684636 29772955 341256427 607882075 971349692 112190239 564717385 907125636 53398971 603233248 596123536 655799990 921760394 540352891 67329005 100552041 232284256 111904168 9990...
output:
828770668
result:
ok 1 number(s): "828770668"
Test #18:
score: 0
Accepted
time: 2806ms
memory: 40968kb
input:
500000 30 320817594 654000310 853103312 314220777 314440615 372432589 564645736 732558967 8260392 150253235 304146143 110336914 868772386 565277851 449553064 258570018 667051166 711738073 295922440 558020255 811486519 574214731 59441609 74132260 1043293010 630216783 135549759 652068497 795394100 298...
output:
906730214
result:
ok 1 number(s): "906730214"
Test #19:
score: 0
Accepted
time: 65ms
memory: 3732kb
input:
500000 1 0 1 0 0 1 0 1 0 0 0 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0 1 0 1 1 0 0 1 1 0 1 1 1 1 1 0 0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 0 0 1 0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 0 0 1 0 0 0 1 0 0 1...
output:
181097888
result:
ok 1 number(s): "181097888"
Test #20:
score: 0
Accepted
time: 96ms
memory: 3712kb
input:
500000 2 1 2 0 1 0 2 3 3 2 1 2 3 0 2 3 2 2 3 1 3 0 2 1 1 1 1 3 1 3 1 2 3 1 2 3 0 3 3 0 2 3 3 0 3 0 0 1 3 1 2 1 3 2 0 2 1 1 2 1 3 3 0 2 1 1 2 3 3 1 3 0 2 3 2 0 0 3 0 1 1 2 2 0 2 2 1 2 1 1 2 2 3 1 3 2 2 1 3 1 0 0 0 0 1 1 1 3 3 0 1 1 3 0 3 1 2 2 1 2 1 2 1 1 3 2 3 1 0 2 3 3 0 0 1 0 1 3 1 2 1 3 0 2 1 0 0...
output:
687623855
result:
ok 1 number(s): "687623855"
Test #21:
score: 0
Accepted
time: 245ms
memory: 3728kb
input:
500000 5 14 22 17 2 15 11 17 5 17 15 22 3 11 31 2 28 12 3 15 31 22 24 20 3 30 10 14 25 4 24 4 27 23 10 8 23 27 30 2 0 23 19 7 17 9 12 0 17 18 15 16 8 25 4 21 17 1 15 28 16 0 17 6 10 12 25 27 14 4 10 13 4 2 7 11 0 26 14 5 31 5 3 3 23 25 9 30 13 8 27 4 17 31 3 22 17 20 28 0 10 19 3 6 28 8 27 18 15 25 ...
output:
622835418
result:
ok 1 number(s): "622835418"
Test #22:
score: 0
Accepted
time: 546ms
memory: 3796kb
input:
500000 10 856 970 406 443 765 933 624 432 886 497 85 266 923 446 574 385 406 670 919 782 980 995 653 372 306 566 872 763 820 655 940 777 912 341 566 196 377 90 112 151 791 392 683 663 265 918 544 653 478 477 865 495 731 163 1005 983 207 265 351 501 836 663 145 960 703 609 492 802 854 827 788 98 590 ...
output:
188485208
result:
ok 1 number(s): "188485208"
Test #23:
score: 0
Accepted
time: 1022ms
memory: 6856kb
input:
500000 15 27436 19759 17989 14016 29351 9027 22878 23375 493 27515 23549 24903 315 23061 25757 17058 1864 7051 30102 6834 11360 31682 17857 13340 18416 7677 14292 14102 31283 32432 29118 21540 3743 12654 29341 26640 17415 1416 9602 20812 8260 18798 2549 31524 31630 17713 19078 12150 27310 177 10790 ...
output:
1032744914
result:
ok 1 number(s): "1032744914"
Test #24:
score: 0
Accepted
time: 2190ms
memory: 28312kb
input:
500000 20 595399 816452 624541 904856 21003 135407 71017 55007 982408 852317 192118 714368 372925 504868 1038018 323825 533838 690687 615209 673098 374113 789997 887853 227012 666338 73589 1037373 185087 283957 874396 942111 213879 106795 840613 81434 235343 796353 760221 217814 465288 11787 68789 5...
output:
409536009
result:
ok 1 number(s): "409536009"
Test #25:
score: 0
Accepted
time: 2776ms
memory: 40200kb
input:
500000 25 19067802 14544791 25094922 28771765 5655376 16549409 5245489 11514410 2880479 5597148 27471827 6089281 15538101 25124497 7207909 15185410 5672258 7360080 20385827 2897907 25020895 25107624 25287245 8713330 30138363 25200774 19229689 28894790 14249446 6164467 29132724 3420898 10899764 28675...
output:
780249768
result:
ok 1 number(s): "780249768"
Test #26:
score: 0
Accepted
time: 2804ms
memory: 40064kb
input:
500000 28 152614559 168140428 64224198 121918464 122849778 83659627 217295184 192622378 261781773 101788852 214755856 129277082 195293407 29297446 93882848 198320685 259042706 149180743 166442363 41079386 101742327 253721117 26241171 237722709 122360149 203892353 33112297 72988388 192464090 15934624...
output:
436932928
result:
ok 1 number(s): "436932928"
Test #27:
score: 0
Accepted
time: 2812ms
memory: 40884kb
input:
500000 29 305277211 191845285 37424942 350623463 476394371 313785791 14606972 94335544 324808232 241585480 68251928 312262716 79998604 302043143 211912079 89952361 481571536 358561552 335121887 452003467 137868096 184768373 471982058 50585219 165555792 51394869 343655057 219487120 79326582 34132224 ...
output:
416804842
result:
ok 1 number(s): "416804842"
Test #28:
score: 0
Accepted
time: 1831ms
memory: 39884kb
input:
500000 30 7 536872004 889 536871096 536871568 1073741186 536868404 1073739135 4658 536877000 536884849 16144 536888745 15098 536888517 17983 536978817 109982 537163990 288696 537547118 678741 537975122 1104461 538406486 1536913 2109524 538980240 539586338 2712484 540166099 3292622 3885543 540760294 ...
output:
989783823
result:
ok 1 number(s): "989783823"
Test #29:
score: 0
Accepted
time: 2247ms
memory: 39872kb
input:
500000 30 468 1073741718 1073741099 1206 4842 7003 17066 22951 75088 83321 207729 198494 388308 401645 775699 760997 1288710 1305104 2045101 2026086 3070757 3092561 4531940 4509426 6265205 6288002 8339114 8362998 10874332 10844941 14401251 14371368 18465354 18430368 23782225 23819611 30212746 301748...
output:
1029936413
result:
ok 1 number(s): "1029936413"
Test #30:
score: 0
Accepted
time: 911ms
memory: 39412kb
input:
500000 30 536871041 536869433 536867584 536870869 536859154 536864895 536833034 536841108 536784571 536774850 536667633 536681246 536479578 536493292 536210275 536194680 535802605 535785238 535218905 535242521 534417522 534441596 533350923 533376400 532005002 531978923 530296444 530267965 528188514 ...
output:
188353798
result:
ok 1 number(s): "188353798"
Test #31:
score: 0
Accepted
time: 1486ms
memory: 40360kb
input:
500000 30 1073741524 536869699 1073739422 536868836 1073737849 536863772 536854939 1073730790 1073706272 536830087 1073653849 536791702 536698515 1073580277 536542704 1073424225 536309854 1073189663 536076943 1072938371 535751099 1072633194 1072246521 535360912 534796944 1071681574 534238464 1071094...
output:
747365272
result:
ok 1 number(s): "747365272"
Test #32:
score: 0
Accepted
time: 1751ms
memory: 40280kb
input:
500000 30 536872432 474 1192 536872952 536875561 6049 536886825 16593 36211 536904853 536958238 85530 160497 537028707 275271 537143265 537318557 451760 537580964 705260 1097284 537963647 1558425 538424091 539019471 2155510 539866066 2988495 4051970 540917667 5293402 542159660 543514554 6648342 8114...
output:
322773522
result:
ok 1 number(s): "322773522"
Test #33:
score: 0
Accepted
time: 2308ms
memory: 39960kb
input:
500000 30 1073741141 1719 4165 1043 9229 13972 43445 36948 101140 109031 227750 218680 419855 408100 736561 749075 1180071 1199757 2065440 2085906 3213239 3190349 4725461 4699630 6714363 6745156 9516214 9547239 12806258 12773647 16681971 16720174 21916831 21876810 28039999 27999319 34953028 34996453...
output:
837889140
result:
ok 1 number(s): "837889140"
Test #34:
score: 0
Accepted
time: 1105ms
memory: 39664kb
input:
500000 30 536871325 536870262 536867480 536870370 536863879 536860428 536847550 536839442 536801141 536788817 536691250 536672547 536467806 536446680 536073674 536096672 535541588 535517269 534767365 534741293 533706271 533732741 532406810 532379454 530724058 530754694 528670451 528706091 526117902 ...
output:
731838342
result:
ok 1 number(s): "731838342"
Test #35:
score: 0
Accepted
time: 1420ms
memory: 39688kb
input:
500000 30 1073741368 536869898 536865717 1073740029 536876357 2293 30056 536904586 536952070 78596 537010593 142115 220100 537092517 537189797 317543 428833 537303433 537532157 663570 537910836 1039475 538316182 1441758 539077545 2202449 539943434 3074957 540882695 4011131 541844685 4973137 54285955...
output:
636800106
result:
ok 1 number(s): "636800106"
Test #36:
score: 0
Accepted
time: 1826ms
memory: 39012kb
input:
500000 30 536872233 453 536871194 1540 536872282 1073739870 1073729238 536862753 536837936 1073704348 1073662979 536787113 1073585954 536720698 536613680 1073478909 536485592 1073351789 536385065 1073259387 1073227759 536360898 536358106 1073225290 1073200253 536333115 1073153899 536276436 536141452...
output:
401254381
result:
ok 1 number(s): "401254381"
Test #37:
score: 0
Accepted
time: 2140ms
memory: 40528kb
input:
500000 30 1724 1073739149 7225 1691 25467 16003 69276 83521 210989 227272 454373 471676 835205 817326 1336840 1317567 2032173 2009319 3036760 3060708 4379513 4353676 6084890 6058707 8128478 8100575 10637997 10667711 13756702 13788745 17597372 17634123 22633216 22593953 28600692 28641750 35621187 356...
output:
422502793
result:
ok 1 number(s): "422502793"
Test #38:
score: 0
Accepted
time: 1297ms
memory: 39632kb
input:
500000 30 536869221 536873313 536860668 536869839 536838089 536848204 536784027 536796722 536678238 536693507 536514180 536498069 536221129 536238760 535839662 535820518 535287016 535266965 534553488 534533020 533615216 533593770 532442766 532416697 530958725 530928210 529076713 529044105 526736499 ...
output:
164414776
result:
ok 1 number(s): "164414776"
Test #39:
score: 0
Accepted
time: 1717ms
memory: 39644kb
input:
500000 30 536870887 1073735255 5808 536870042 16241 536897122 76885 536956358 537056817 176730 537207171 343659 537421711 542207 537721056 839681 538166099 1282760 1922824 538783422 2667818 539547753 540421005 3541339 4529103 541410727 5893619 542756984 7414676 544293083 545940934 9059805 548084947 ...
output:
8844860
result:
ok 1 number(s): "8844860"
Test #40:
score: 0
Accepted
time: 2004ms
memory: 39044kb
input:
500000 30 536872809 687 536871189 1945 536869686 1073738734 536862371 1073733088 536869589 1073739627 3733 536873076 3388 536876314 536878119 2569 536842637 1073708698 1073635158 536760690 1073585991 536719186 1073559533 536693327 536628890 1073492442 536463225 1073342025 536218413 1073080559 107271...
output:
260254628
result:
ok 1 number(s): "260254628"
Test #41:
score: 0
Accepted
time: 2248ms
memory: 40484kb
input:
500000 30 1073740860 329 2128 1073737347 14350 22904 76151 64794 189843 177264 378969 365411 665285 648264 1142439 1124084 1803296 1784457 2631397 2651770 3748240 3772484 5345954 5373007 7485804 7455578 10205894 10239154 13696357 13731446 17943564 17906600 22932610 22970779 28768366 28812984 3644383...
output:
18409590
result:
ok 1 number(s): "18409590"
Test #42:
score: 0
Accepted
time: 1592ms
memory: 40712kb
input:
500000 30 536870842 536872807 536870920 536866072 536859509 536853103 536829013 536817916 536755671 536741351 536593212 536608802 536368536 536350913 536005795 535986092 535463858 535487286 534731434 534757161 533741488 533767733 532462256 532490316 530846682 530875676 528884220 528854057 526439530 ...
output:
195818233
result:
ok 1 number(s): "195818233"
Test #43:
score: 0
Accepted
time: 2064ms
memory: 41032kb
input:
500000 30 536870154 1073738512 1398 536868659 536882833 7863 536909813 34572 536956731 81656 158453 537024892 260091 537136224 436344 537312218 659919 537536831 982733 537847223 1383548 538261511 1963433 538841350 2637411 539514604 3440945 540304023 541461250 4581588 542879629 6000780 544594248 7715...
output:
241551335
result:
ok 1 number(s): "241551335"
Test #44:
score: 0
Accepted
time: 2148ms
memory: 40216kb
input:
500000 30 1834 536872276 1996 536874194 7520 536879565 536882265 9465 9601 536880222 536903982 32569 64172 536938133 536966701 92760 536981790 107419 102063 536969019 536995292 120294 124845 536999609 537003603 130372 537114646 245352 440191 537313761 537556630 684679 1221001 538086027 2818994 53969...
output:
994723906
result:
ok 1 number(s): "994723906"
Test #45:
score: 0
Accepted
time: 2336ms
memory: 40832kb
input:
500000 30 1940 1073741379 1055 5042 11377 18675 53258 63090 149342 163423 374808 359987 670793 687393 1152960 1135286 1770465 1790593 2697701 2676067 3864900 3887890 5380433 5405495 7361853 7335132 9796159 9766176 12913957 12944288 16549077 16584987 21428781 21469004 27624248 27580164 35163264 35118...
output:
678044413
result:
ok 1 number(s): "678044413"
Test #46:
score: 0
Accepted
time: 1874ms
memory: 39296kb
input:
500000 30 536872517 536870109 536866097 536870571 536859254 536854522 536828352 536834827 536784409 536776845 536696955 536687378 536552471 536540516 536309882 536322214 535979585 535993149 535528297 535542454 534950832 534930610 534113995 534136067 533056073 533033867 531664944 531688294 529992978 ...
output:
469170402
result:
ok 1 number(s): "469170402"
Test #47:
score: 0
Accepted
time: 2125ms
memory: 39940kb
input:
500000 30 1073740982 536869930 536869517 1073739875 1073736843 536867635 536879394 5990 36427 536911077 536970274 101507 179010 537048306 248163 537117230 537191979 323702 381820 537255217 437183 537305139 537364381 496741 564350 537431851 660938 537533874 922508 537791557 1188138 538057869 53839196...
output:
903771078
result:
ok 1 number(s): "903771078"
Test #48:
score: 0
Accepted
time: 2396ms
memory: 38856kb
input:
500000 30 536871795 517 536871988 1155 536873405 1894 536874103 2633 68890774 144686429 1010555543 473686942 137519345 1045707547 193197800 730067807 565655704 28788491 938092342 401226079 236825737 773701886 609263924 72388520 981679420 444812637 280335622 817210878 652711325 115843646 488348042 10...
output:
719940283
result:
ok 1 number(s): "719940283"
Test #49:
score: 0
Accepted
time: 2482ms
memory: 39380kb
input:
500000 30 1073741027 437 5887 154 23367 17111 218735812 656907911 987042231 987051817 735288170 912406085 883705964 883688679 216106420 216086707 622426086 622450106 249777780 348922704 465988791 465961466 955337598 955367858 371471326 371504194 861926618 861960134 279190114 279155595 770726357 7707...
output:
794235368
result:
ok 1 number(s): "794235368"
Test #50:
score: 0
Accepted
time: 2290ms
memory: 40424kb
input:
500000 30 536871313 536868016 536863959 536869115 536848598 536855640 536821945 536811297 536745737 536732451 536588577 536606300 536336990 536356959 535946589 535967245 1026647755 830608624 918520376 918544432 917750351 917723778 916635433 916662837 915246073 915216305 913443551 913411399 103312701...
output:
12261217
result:
ok 1 number(s): "12261217"
Test #51:
score: 0
Accepted
time: 2388ms
memory: 40728kb
input:
500000 30 1073741698 536868911 536866929 1073736208 536859728 1073733872 536849120 1073722696 536830348 1073705437 1073668692 536801425 536758243 1073632621 536699128 1073573397 536618971 1073492414 536602046 1073469791 1073440210 536566508 536541346 1073415454 536518020 1073393347 1073345436 536477...
output:
619705540
result:
ok 1 number(s): "619705540"
Test #52:
score: 0
Accepted
time: 2725ms
memory: 40048kb
input:
500000 30 838788719 712888440 550365344 98146253 1011987962 668874127 550463014 166629646 831911091 224092213 715867505 154189583 790722952 22189487 183611192 836297122 194038080 1035030358 488276713 913492848 348755454 26956113 836812026 1025938637 799897582 245919955 283855650 820720866 670781085 ...
output:
1072372687
result:
ok 1 number(s): "1072372687"
Test #53:
score: 0
Accepted
time: 2803ms
memory: 40644kb
input:
500000 30 1057956723 850814062 65340790 191088050 1003102523 320539705 426878585 636901812 345257792 456247963 701248149 219414737 747314263 65140710 992546496 593812478 192290587 192309370 37838390 37857451 929799251 152030510 218723883 984425625 402727988 422717748 1048528541 705890737 193317790 5...
output:
472311375
result:
ok 1 number(s): "472311375"
Test #54:
score: 0
Accepted
time: 2737ms
memory: 39120kb
input:
500000 30 1069419163 407893068 593988088 404252924 140996741 553029112 22070214 22061920 654006247 180482576 1055403349 656573779 697293036 584259711 316783050 875576645 51179196 926623406 264822069 936693474 709509107 794508738 397576177 1047885806 553844157 282417786 788337569 788316719 270578405 ...
output:
464495193
result:
ok 1 number(s): "464495193"
Test #55:
score: 0
Accepted
time: 2747ms
memory: 39908kb
input:
500000 30 549235007 564495024 647979562 238507360 495026791 937525890 899711855 233998193 362108036 17265547 141104583 107522032 836187978 878743398 455251706 992121289 634883986 724531925 839804252 579760937 631430119 94558332 747191483 35031134 141719300 480549026 679184233 294771048 60964593 4286...
output:
703806629
result:
ok 1 number(s): "703806629"