QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#401963 | #984. Happiness | grass8cow | RE | 33ms | 12420kb | C++17 | 1.9kb | 2024-04-29 17:41:05 | 2024-04-29 17:41:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353,G=3,GI=(mod+1)/3;
int qpow(int a,int b){
int c=1;
for(;b;b>>=1){
if(b&1)c=1ll*a*c%mod;
a=1ll*a*a%mod;
}
return c;
}
int lb[1<<20],L;
void init(int n){
L=1;while(L<=n)L<<=1;
for(int i=0;i<L;i++)lb[i]=(lb[i>>1]>>1)|((i&1)?(L>>1):0);
}
void NTT(int *a,int fl){
for(int i=0;i<L;i++)if(i<lb[i])swap(a[i],a[lb[i]]);
for(int o=1;o<L;o<<=1){
int Wn=qpow(fl?G:GI,(mod-1)/(o<<1));
for(int i=0;i<L;i+=(o<<1))for(int j=0,w=1;j<o;j++,w=1ll*w*Wn%mod){
int x=a[i+j],y=1ll*w*a[i+j+o]%mod;
a[i+j]=(x+y)%mod,a[i+j+o]=(x-y)%mod;
}
}
if(!fl){
int I=qpow(L,mod-2);
for(int i=0;i<L;i++)a[i]=1ll*a[i]*I%mod;
}
}
int se[201000],n,m,a[200100],p[201000],q[201000];
const int B=1000;
bool isi[200100];
int f[201000],z[201000];
int F[1<<20],Q[1<<20];
void build(){
for(int i=0;i<L;i++)F[i]=0;
//n-1-i i+j
for(int i=0;i<n;i++)F[n-1-q[i]]++;
NTT(F,1);for(int i=0;i<L;i++)F[i]=1ll*F[i]*Q[i]%mod;NTT(F,0);
for(int i=0;i<n;i++)f[i]=F[n-1+i];
}
int main(){
scanf("%d%d",&n,&m);init(n*4);
if(n&1){for(int i=0;i<=m;i++)puts("0");return 0;}
for(int i=0;i<n;i++)scanf("%d",&se[i]),se[i+n]=se[i];
for(int i=1;i<n*2;i++)(se[i]+=se[i-1])%=mod;
for(int i=0;i<n;i++)a[i]=(se[i+n-n/4-1]-se[i+n/4])%mod;
for(int i=0;i<n;i++)p[i]=q[i]=i;
for(int i=0;i<n*2;i++)Q[i]=a[i%n];NTT(Q,1);
build();printf("%d\n",(f[0]+mod)%mod);
int dt=0;
vector<int>xz;
for(int i=1,oo,x,z;i<=m;i++){
scanf("%d",&oo);
if(oo==1){scanf("%d",&z);(dt+=z)%=n;}
else{
scanf("%d%d",&x,&z);(x+=n-dt)%=n;
(p[x]+=n-z)%=n;
if(!isi[x])isi[x]=1,xz.push_back(x);
}
int ans=f[dt];
for(int o:xz)(ans-=a[(q[o]+dt)%n])%=mod,(ans+=a[(p[o]+dt)%n])%=mod;
printf("%d\n",(ans%mod+mod)%mod);
if(!(i%B)){for(int j=0;j<n;j++)q[j]=p[j];for(int o:xz)isi[o]=0;xz.clear();build();}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 11992kb
input:
6 3 1 2 4 8 16 32 2 1 4 1 5 2 4 2
output:
189 168 210 252
result:
ok 4 number(s): "189 168 210 252"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5736kb
input:
291 297 690864 66051 879316 361679 613199 616 951868 674311 509731 765530 914257 643036 149469 265479 385645 752029 360309 48606 545052 618893 70334 418974 673141 754792 299130 398298 719505 772883 898465 697947 205006 95537 798625 696927 962164 140276 704224 146457 73196 100864 371302 485115 950286...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 298 numbers
Test #3:
score: 0
Accepted
time: 1ms
memory: 5712kb
input:
295 295 552765 106849 337718 329913 575893 164618 897059 355495 919669 763217 652119 598602 375615 550063 362338 802065 404469 248822 475588 743741 236314 886569 896687 949368 736118 824720 290749 488403 70211 243198 671570 94895 649763 349076 476023 628472 417057 350655 342355 826342 147267 922532 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 296 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 11988kb
input:
296 292 197804 718425 56634 403100 978753 617316 121593 944167 884895 801844 613148 623615 822920 116431 372795 179915 790109 774901 961724 265875 718476 818274 593528 45207 199271 233902 751601 242247 11775 88033 912182 946726 998679 382162 791540 990712 283984 188914 36965 121390 716244 896446 236...
output:
712685820 712685820 712685820 712685820 712685820 717318054 716983869 717589993 710256209 706016424 707153891 701271087 724635284 724417845 719673709 704630730 712569827 708723732 703114919 697699010 704624679 702212682 721430608 700393096 702244685 703289901 721707329 727986071 691394429 721590721 ...
result:
ok 293 numbers
Test #5:
score: 0
Accepted
time: 2ms
memory: 11996kb
input:
294 291 503603 1295 528959 874005 16784 356063 407396 710552 364457 854105 81255 277227 337622 924237 786842 937442 324199 347508 759112 474964 795014 41077 989187 995407 337551 790107 640382 634943 493635 300299 850365 259818 324049 363697 636774 727713 680955 275129 475482 233431 36465 715331 5493...
output:
243211064 243211064 243211064 241304462 246487749 244149180 242849351 243729937 242981876 240473501 241289144 239589122 242722412 243440252 240166011 244646621 239804677 244016243 246138296 246359596 244043738 245210022 244984337 243219614 242919477 249046022 239542717 237287596 243926344 240551676 ...
result:
ok 292 numbers
Test #6:
score: 0
Accepted
time: 2ms
memory: 12260kb
input:
290 295 634846 383682 38882 644797 112952 89231 370780 569445 45432 884805 995805 720763 851778 285921 170815 784518 955568 544322 4855 150378 799076 255752 760947 318089 774545 687763 86803 83267 675405 875841 577183 235032 795668 213958 200001 669641 703427 879349 974729 166286 705661 99867 768052...
output:
661217387 662720782 664133599 667055435 657358941 651597268 657027416 667545462 669288496 673748254 666644307 663744430 656531174 653988862 653971836 654448278 656922978 658083597 652087448 651320779 643062959 643110255 648191618 649160297 649025433 645422902 646683457 641868826 648343369 675058634 ...
result:
ok 296 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 11964kb
input:
296 299 576338 488913 542853 19862 318192 797562 789873 768709 471762 942794 340062 306502 602999 92722 873773 803924 629926 746752 630109 673400 285755 264681 739304 753534 725126 412467 42700 679018 472050 415678 782065 998053 524534 670135 4509 634161 251237 317905 241361 809368 103497 453789 551...
output:
546525987 548661825 550242498 552059588 549748106 551415281 548838169 548828143 543338259 542314650 541329112 536944262 537750574 538633714 535613227 531320381 530327955 529830727 528071082 526052276 529587817 522829507 522380369 523175114 523338147 518718284 520653264 522763096 515176718 517589791 ...
result:
ok 300 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 12072kb
input:
290 298 151200 308307 900299 878140 223630 304554 269381 668041 60602 812740 766872 602070 222004 180951 834538 488511 129084 736264 166993 606493 145061 189042 712088 609067 158544 950103 957775 440199 679482 15931 180678 699695 531055 226971 631904 290559 144208 135884 30014 642873 465203 694973 5...
output:
893351222 895575721 893047662 895517900 892249060 893309964 895692688 896052372 894004390 895205404 895535502 892972727 892584945 892506117 895929901 891956833 890661249 892744200 889295979 888679699 889008094 884827111 885668384 890467434 892747934 896147236 896667140 894980669 897000912 894129337 ...
result:
ok 299 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 11984kb
input:
296 298 425281 421489 461896 866489 536895 67961 72400 379755 625272 468574 822933 179873 855224 810597 102758 305742 869092 739997 402170 717754 585255 482055 277570 992051 688845 259461 789058 288320 987711 626161 319504 212094 26601 394072 696898 660687 844239 656280 223631 20777 389037 904384 18...
output:
263487777 262600013 272182443 276559065 271341904 273605796 279384006 278653078 270815654 272650989 280729803 280282905 282779644 292309794 293991227 295060256 285788655 284328919 249355690 247359878 247687195 286643787 276079031 273067081 273406277 265470938 285860917 275266405 277391440 271310660 ...
result:
ok 299 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 11996kb
input:
294 294 499344 613463 108432 253232 87241 321758 353501 431564 457147 677802 499260 641105 802301 552240 182592 56884 285407 964992 188688 827027 946475 163913 961690 913830 118193 701604 846246 83865 927069 813398 823361 458494 646628 649547 904552 40435 714332 588582 976811 566510 694806 404161 98...
output:
442254931 441444783 439780351 436137202 438701542 439049415 449382366 445009322 450669286 446603717 441837184 444178344 440481413 437966802 432528147 431514855 433047909 432988889 433088279 436782416 435752755 442506853 447059790 444930641 439523512 439676301 436460229 437876893 432278319 432212815 ...
result:
ok 295 numbers
Test #11:
score: 0
Accepted
time: 2ms
memory: 12260kb
input:
300 293 176941 206958 800930 287691 315331 101605 771110 653884 595905 521021 566074 833285 185348 797081 27113 55232 155239 478879 786683 459848 375013 791591 836072 775374 443569 61956 397251 185997 531359 366812 430405 553512 968729 835358 19742 233562 487112 737151 589133 757106 75237 115225 636...
output:
345276637 343152604 342183550 341560095 347692889 343075451 347239383 348493607 339334204 338845322 339313723 336219886 337421843 347492342 348516254 349909347 351225867 341952444 346099043 346499456 351257635 351617801 360737036 357881558 363889484 358359972 361662538 349669834 355645347 354566130 ...
result:
ok 294 numbers
Test #12:
score: 0
Accepted
time: 1ms
memory: 12040kb
input:
2 296 491672 128320 1 1 2 1 1 1 1 1 1 2 0 1 2 1 1 2 1 1 2 0 1 2 0 1 2 1 1 2 1 1 1 1 1 1 1 1 2 0 1 2 1 1 1 1 1 1 1 1 2 0 1 1 1 1 1 2 1 1 1 1 2 0 1 2 1 1 1 1 2 0 1 2 0 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 2 0 1 1 1 1 1 2 0 1 1 1 2 0 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 2 0 1 2 0 1 2 1 1 1 1 2 ...
output:
619992 619992 256640 983344 256640 619992 983344 619992 256640 619992 983344 619992 619992 619992 619992 256640 619992 619992 619992 619992 983344 256640 983344 619992 619992 256640 619992 619992 983344 619992 619992 619992 256640 983344 256640 619992 619992 619992 619992 619992 256640 619992 619992...
result:
ok 297 numbers
Test #13:
score: 0
Accepted
time: 1ms
memory: 5788kb
input:
293 300 539792 607476 714416 326858 535343 411400 267409 988390 60911 668742 931493 956011 528193 855993 367235 549239 105615 502706 17167 921309 386464 12831 256984 427485 773206 611080 733757 831462 607870 761942 105161 967256 831191 605522 582360 290954 899262 523044 135650 157737 543171 274867 8...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 301 numbers
Test #14:
score: 0
Accepted
time: 0ms
memory: 11956kb
input:
2 299 549355 144658 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 0 1 1 1 1 1 1 1 2 1 1 2 1 1 2 0 1 1 1 1 1 2 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 1 2 0 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 0 1 2 0 1 1 1 1 1 2 0 1 1 1 2 1 1 2 0 1 2 0 1 2 0 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 ...
output:
694013 694013 694013 694013 694013 289316 1098710 289316 694013 694013 694013 694013 1098710 694013 289316 1098710 289316 694013 694013 694013 694013 694013 694013 694013 694013 289316 694013 694013 694013 1098710 289316 1098710 694013 694013 1098710 694013 1098710 289316 1098710 694013 694013 28931...
result:
ok 300 numbers
Test #15:
score: 0
Accepted
time: 1ms
memory: 6028kb
input:
3 291 421433 380426 269925 2 1 1 1 2 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 2 1 1 1 2 2 0 1 1 1 1 1 2 0 1 1 2 2 0 2 1 1 1 2 2 1 2 1 2 2 1 2 1 1 2 1 1 1 2 2 1 2 1 1 2 2 1 2 0 1 2 1 1 1 1 1 1 1 2 1 1 2 2 1 2 0 2 2 0 1 2 1 1 2 0 1 1 1 2 1 1 1 2 2 2 2 1 2 1 2 2 1 2 1 1 1 1 2 1 1 2 1 2 1 2 1 2 1 1 2 0 2 2 0 1 2 1...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 292 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 12012kb
input:
296 291 443573 87168 70509 121283 207008 676413 207870 305388 900593 900207 519086 496912 380909 31375 715795 842545 521180 672912 572143 543823 89521 364773 84775 109262 398052 196913 221486 784609 246527 110072 346720 905264 512272 284114 130199 87990 265837 658150 767614 444366 976325 119461 9876...
output:
408209264 410904069 407783354 407889591 404612719 408222638 408329118 410871095 410553419 410760225 404771330 396583805 410618199 424918180 430830969 433996583 438298445 407981513 405650757 405250781 405059413 406399976 438502154 440402308 399005857 403800858 382250486 423905275 424855948 424045449 ...
result:
ok 292 numbers
Test #17:
score: 0
Accepted
time: 2ms
memory: 11956kb
input:
296 294 370806 875916 769238 796332 473968 630635 495988 355719 713496 85351 342821 862256 230081 387167 194363 70269 71058 920136 389543 210820 751418 999083 642329 974428 947727 772601 903349 371476 899951 812237 313814 756252 13190 45438 469838 727029 507273 575501 974326 373310 528619 858477 393...
output:
812154399 812282415 809217594 808896578 812561564 818669736 815154285 807184486 805414722 804180713 808631046 813666601 816241667 815870552 811034805 806778615 815605046 814661152 809366102 809214057 810373552 819886895 809682752 808318793 820071624 813580972 817504349 802780302 804915093 803745051 ...
result:
ok 295 numbers
Test #18:
score: 0
Accepted
time: 2ms
memory: 12036kb
input:
292 299 92412 17245 409628 838582 726437 952708 506916 645415 328927 311600 879757 420387 195018 893486 165957 732299 693905 181057 778000 752226 460435 313517 943925 606583 931834 328800 429492 12530 938488 518134 530991 496173 266331 332698 573204 962515 23859 255186 860029 145825 674827 300651 74...
output:
214241547 214241547 214241547 216447784 215312916 220741565 221170566 224715089 226089093 227618210 207443226 208257890 208520470 202466760 201776778 200810181 200562627 208649535 198694636 196398731 200310391 195816489 230483659 199905114 229959911 206785713 202908538 199472988 201962340 202506093 ...
result:
ok 300 numbers
Test #19:
score: 0
Accepted
time: 1ms
memory: 5788kb
input:
297 297 325934 894115 731417 648065 379449 469115 617857 109051 609229 384652 492 606074 200806 222598 335262 406449 499634 46389 84951 675088 719359 55388 595776 512672 60540 355 826059 982722 604242 638645 102271 143837 285468 819481 366965 274788 324890 321226 977593 508018 250966 732914 520084 8...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 298 numbers
Test #20:
score: 0
Accepted
time: 2ms
memory: 11992kb
input:
296 295 277227 455802 718916 39599 204339 255491 354412 298847 623780 992147 665348 552924 970956 206045 408262 128221 485846 183409 294463 637497 897503 938678 82310 157570 28634 270780 770260 302173 419875 792079 876185 366927 281771 497867 448061 517198 186664 474844 530682 619723 523645 512167 3...
output:
600776484 603331648 601497101 593239343 607729169 605342728 608478604 601084966 605682457 603187126 603002394 599427868 595889868 592986963 594115767 592126242 599184727 604843450 608416009 608494340 607074355 615658165 601353198 606693561 609964330 595717399 594436850 590115637 589702153 601156084 ...
result:
ok 296 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 11996kb
input:
292 300 748325 396502 654709 495733 428819 818215 304823 650974 34112 720308 43918 836218 398242 742046 168010 597633 218325 710548 942648 624992 9462 902612 94385 545900 792350 52276 882165 67078 76777 275865 997570 728270 202447 489738 480119 965508 371541 5749 663387 207121 670280 157468 388200 5...
output:
924770955 923310883 925495106 927201764 923830741 924279796 924247712 924908794 924309891 924247712 924903324 925221375 927002822 925299597 924903324 924220043 921595063 924908794 925389024 928085590 927970900 922330725 925062460 924214290 922843082 924983638 921680673 925685545 923169795 923551448 ...
result:
ok 301 numbers
Test #22:
score: 0
Accepted
time: 1ms
memory: 5784kb
input:
4999 5000 615912 882074 934067 327162 59021 352357 67254 207841 208595 429172 448781 601247 896943 560595 836640 390651 744738 78717 503551 106977 175201 545393 859962 740149 820609 729713 320319 467517 510550 633637 377636 504995 964236 32314 955208 578205 964014 492864 73612 830746 397921 617693 6...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 5001 numbers
Test #23:
score: 0
Accepted
time: 17ms
memory: 12376kb
input:
4990 4993 278417 57614 668216 652861 320183 509539 295777 603032 454196 260568 752864 280596 873924 427787 204545 359260 534407 318875 176613 169071 594799 574779 194348 301661 545573 482422 235733 323062 270634 32922 583619 122913 140975 89625 151508 824644 719486 706609 995155 202598 374305 36105 ...
output:
181331137 166151335 175747282 164378978 184170435 162563546 191762651 174846907 184199436 170792617 162271009 165797782 169543762 193299702 198076706 183403974 192860660 196626738 201697436 162700358 195036785 186959307 183354128 180781959 172271911 183768449 147634697 176660830 180122695 185314460 ...
result:
ok 4994 numbers
Test #24:
score: 0
Accepted
time: 20ms
memory: 12060kb
input:
4998 4991 58395 895856 254639 592416 983056 629881 866720 373097 367155 495923 476228 159916 830413 152066 770457 274439 313919 77568 772164 691004 753623 589218 16575 104911 422736 385684 221484 747559 63474 219304 228429 546663 280972 438162 638310 954240 564003 528037 339930 873855 167251 464783 ...
output:
773504435 773504435 773504435 740864153 738159743 820369393 737815144 716695593 813315658 806116266 794715874 743206692 739467762 807423372 754822296 824353433 794143882 824449830 803364289 726457313 736010229 724444570 724813186 812123681 724637680 737560639 777973063 770853201 811067877 724162880 ...
result:
ok 4992 numbers
Test #25:
score: 0
Accepted
time: 20ms
memory: 12192kb
input:
4992 4993 794303 498171 272553 399699 159188 690772 532846 43040 527166 700076 732783 60552 507362 228006 472405 535773 563977 559255 212982 928187 820759 54861 29638 905730 458294 507831 491501 459079 801335 802964 174930 214721 454521 468550 642495 822377 803541 170203 10293 367713 57674 704983 49...
output:
485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 485188781 479349850 472156462 502815352 487590116 484635415 ...
result:
ok 4994 numbers
Test #26:
score: 0
Accepted
time: 33ms
memory: 12188kb
input:
4992 4998 199061 598714 940177 105350 624522 512648 516355 789958 829641 887169 408961 687871 814533 89300 659553 862858 977762 437805 920555 718267 61828 130170 543070 348778 990267 77902 972936 458479 145029 225933 831548 369254 223546 573912 199739 79251 318183 553738 29065 430499 555108 745743 2...
output:
729129081 724983869 754919175 753921284 754257419 736917297 714614621 746483788 749229178 749545532 727061196 734401659 723008016 743248371 748418589 729203353 735564405 758034670 760381529 754093707 733119646 715826066 737381572 734601602 739859475 715558530 693058434 693632066 685840881 684867696 ...
result:
ok 4999 numbers
Test #27:
score: 0
Accepted
time: 32ms
memory: 12128kb
input:
4998 4995 366453 317940 946968 681182 320429 900204 669018 479271 927319 706071 431358 950576 948035 76657 566940 197985 474277 91101 506335 756891 557745 967967 848504 926266 237593 29036 440889 300704 341141 416780 189739 966861 766611 464645 709179 270891 238236 666354 438629 461302 866068 261452...
output:
494697413 492135496 476389254 464884866 460333074 453262789 426322979 451853087 464637318 476963706 465536833 447589298 441562777 450447366 452528356 457334030 467426891 469538141 467898371 472808265 493962755 515887658 516135979 462397427 487781016 497664338 508361162 521742562 522877268 519894293 ...
result:
ok 4996 numbers
Test #28:
score: 0
Accepted
time: 1ms
memory: 5784kb
input:
4993 4996 782287 330607 562733 61466 488515 971979 327446 851982 132857 30467 137698 637357 4863 98371 701847 672635 26644 179681 863332 350722 479832 371940 812551 934238 190258 377317 817983 688929 853416 654878 70492 435770 935835 203454 872905 352754 547651 894173 436511 609868 613425 357593 160...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 4997 numbers
Test #29:
score: 0
Accepted
time: 1ms
memory: 5780kb
input:
4999 4994 124665 463833 123858 519561 152418 371390 609198 275590 818826 902279 530017 655147 546658 802051 67505 953952 747397 356057 615014 96343 994334 276339 895690 104881 862875 551756 322437 774879 26037 499773 14852 434885 339529 963319 879748 446602 759313 825346 701576 491459 178820 676023 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 4995 numbers
Test #30:
score: 0
Accepted
time: 1ms
memory: 7832kb
input:
4997 4999 393676 296762 73072 879741 737050 492733 802278 108454 522484 679622 292407 103081 533301 797391 252129 623329 721517 651449 981038 751446 841990 382730 52127 881212 864828 193606 912854 671228 761549 781874 304732 426182 332427 302439 88610 838273 380309 537456 284317 110050 732919 283687...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 5000 numbers
Test #31:
score: 0
Accepted
time: 30ms
memory: 12132kb
input:
4992 4995 383827 617888 845563 784830 274100 915473 872296 604278 976896 860142 887023 235822 854877 171829 849308 404685 305674 675328 387524 985467 498792 228815 96576 43987 472546 128818 599631 591943 390600 724807 156203 132845 792335 231687 778228 907132 274800 315470 65212 330302 547983 730040...
output:
161979955 166859395 157247458 139579803 120094806 98536551 105648872 90500328 95236399 93302399 85904789 70549448 78285155 85520083 83874927 76435430 99248082 83769290 99970782 103926243 102640832 88490172 87698824 103801895 113890023 114702248 104752403 87104672 102123977 101962886 96686435 1084026...
result:
ok 4996 numbers
Test #32:
score: 0
Accepted
time: 2ms
memory: 12024kb
input:
2 4994 925560 565704 2 0 1 1 1 1 1 2 1 1 2 1 1 1 1 2 0 1 2 0 1 2 0 1 2 0 1 2 1 1 2 0 1 2 0 1 2 1 1 2 0 1 1 1 1 1 2 0 1 2 1 1 2 0 1 1 1 2 1 1 2 1 1 1 1 1 1 2 0 1 1 1 2 1 1 1 1 2 0 1 1 1 2 0 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 0 1 1 1 1 1 1 1 2 0 1 2 0 1 2 1 1 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 2...
output:
1491264 1851120 1131408 1851120 1491264 1851120 1131408 1491264 1131408 1491264 1131408 1491264 1851120 1491264 1131408 1491264 1491264 1491264 1131408 1491264 1851120 1131408 1491264 1131408 1851120 1131408 1491264 1491264 1851120 1131408 1491264 1491264 1131408 1491264 1491264 1131408 1491264 1491...
result:
ok 4995 numbers
Test #33:
score: 0
Accepted
time: 18ms
memory: 12120kb
input:
4996 4995 109093 723008 166553 373855 771959 163956 213756 258345 609690 703074 98934 509230 957500 590690 155113 996515 55252 359110 914434 961868 14398 668824 846362 131034 487447 987737 617868 670320 235469 204903 670610 84846 392734 82629 970636 582204 697924 249939 695556 756832 432504 826218 7...
output:
750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 750601699 ...
result:
ok 4996 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 11992kb
input:
2 4991 829161 782364 1 1 2 1 1 1 1 1 1 2 0 1 1 1 1 1 2 1 1 1 1 2 0 1 2 0 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 0 1 2 1 1 1 1 1 1 1 1 1 1 2 0 1 1 1 2 0 1 2 1 1 1 1 1 1 2 0 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 0 1 2 0 1 2 0 1 1 1 2 1 1 1 1 1 1 2 0 1 1 1 1 1 1 1 1...
output:
1611525 1611525 1564728 1658322 1564728 1611525 1611525 1611525 1658322 1564728 1611525 1564728 1611525 1611525 1611525 1611525 1564728 1658322 1564728 1658322 1611525 1564728 1658322 1564728 1658322 1564728 1611525 1611525 1564728 1611525 1611525 1611525 1658322 1564728 1658322 1564728 1658322 1564...
result:
ok 4992 numbers
Test #35:
score: 0
Accepted
time: 3ms
memory: 12252kb
input:
4 5000 980919 707511 702795 761042 1 1 2 0 3 2 2 1 2 2 2 1 1 1 1 1 2 2 0 3 1 3 1 3 2 2 3 2 2 1 2 2 1 2 0 2 1 1 1 3 1 3 1 2 1 2 2 0 3 2 3 3 2 0 3 2 3 2 1 3 1 3 2 3 3 2 3 2 2 2 3 1 1 1 3 2 1 3 2 1 3 1 3 2 1 3 2 2 2 1 2 2 0 3 1 3 2 1 2 2 1 1 1 2 1 1 2 3 1 1 1 1 3 1 3 1 3 1 3 1 1 1 1 2 2 2 2 3 3 2 1 3 1...
output:
3152267 3152267 3210514 2990637 2937106 3367428 2937106 2937106 3156983 3425675 2932390 2990637 2932390 2937106 2883575 3089304 2883575 3645552 3089304 3645552 3703799 3430391 3650268 3703799 2985921 2815896 2874143 2820612 2878859 3147551 2878859 2874143 2932390 3094020 3152267 2874143 3430391 3156...
result:
ok 5001 numbers
Test #36:
score: 0
Accepted
time: 27ms
memory: 12420kb
input:
4998 4992 736833 249616 152582 577870 588118 70703 947505 494081 488036 643850 799011 552031 256322 464009 246793 389032 577047 591574 734747 931062 640735 114128 146046 357415 480124 65731 397328 697813 550289 638064 166827 244701 340278 788687 155745 436958 193418 169731 543 984307 713909 402763 2...
output:
846251477 846251477 846251477 837449529 836986624 820249561 875256861 817353607 820266224 813518451 838572024 826640410 799432255 786351771 775890781 813055027 804040717 850710688 843371825 767414098 907021311 898279914 887131447 876322421 863362667 861410462 861266009 921864054 917935930 889604068 ...
result:
ok 4993 numbers
Test #37:
score: 0
Accepted
time: 19ms
memory: 12128kb
input:
4998 4992 707378 315594 689086 378006 280027 890049 636417 757236 804163 410446 72212 823606 746477 657074 713009 923457 539829 591157 162135 274677 245839 747227 204166 590377 90789 270057 275136 689815 558429 404314 544033 207319 195423 92103 401690 375547 783862 397360 62093 288237 601285 243144 ...
output:
456343529 484806753 502899084 399569256 455626926 480720910 437022487 441849102 513764170 532411579 522253991 524056661 621348550 594907952 312020343 356159474 331402012 330384792 343374618 344347059 446508449 426054832 406256776 393167219 612468541 374834475 376923928 421048723 459419490 603822967 ...
result:
ok 4993 numbers
Test #38:
score: 0
Accepted
time: 1ms
memory: 6032kb
input:
4991 4991 932532 964662 38364 149546 532119 404464 642457 307946 771822 153668 109869 883704 335702 125505 581904 533639 335267 945928 937002 57981 606149 527903 389101 678952 205256 503888 69934 439654 908143 143521 730082 718156 937873 247783 431826 485436 899054 594423 554727 267479 414151 869282...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 4992 numbers
Test #39:
score: 0
Accepted
time: 22ms
memory: 12088kb
input:
4998 4995 961463 735303 705993 804560 843961 861890 478279 96729 299136 285529 549575 805583 659746 431336 276019 723851 730387 193005 392367 972261 66451 423603 891754 958850 671666 695413 747178 707183 928474 284448 586204 508857 566862 773617 992068 387766 915510 179888 56440 815489 331324 460136...
output:
160411828 161158541 172630612 160610678 163076577 161867018 170910565 153396763 142125957 153534638 152199243 172222424 173105776 178696088 161733061 184782038 183427073 181454226 119414756 145147836 153751256 161917085 151156375 171550862 151988383 152667618 152421827 138319348 150848895 163001090 ...
result:
ok 4996 numbers
Test #40:
score: 0
Accepted
time: 27ms
memory: 12084kb
input:
4994 4997 802287 58323 47291 61777 964677 256712 500956 205262 243421 210877 460484 188764 701950 267377 906702 539007 668598 779906 371702 87064 818708 84551 999887 565824 426522 788965 186274 221013 610072 351236 441432 525678 202009 270167 908166 265317 650146 260069 415136 674345 408372 953178 7...
output:
424294817 447064164 430725433 414239060 422306469 420448048 416424354 401466105 409243382 417830409 434151776 409724208 395542187 458041452 436360225 430459719 415085429 437481260 433246855 372009962 376275794 395380646 389347761 420111050 460235862 455376948 437531182 433623590 462398411 461019380 ...
result:
ok 4998 numbers
Test #41:
score: 0
Accepted
time: 20ms
memory: 12416kb
input:
4998 4995 995730 647785 312033 510242 827646 370768 256931 521938 509255 813115 67769 490562 659948 659805 976364 969691 607250 944014 676053 743971 811360 69988 256441 464598 569350 794156 770561 723624 129232 39571 855760 32059 742510 381328 551161 581810 496130 776480 643158 336714 246402 558055 ...
output:
119016940 119016940 119016940 119016940 119016940 119016940 119016940 116588190 118295635 110521782 121731304 118352943 112251525 113260649 105387772 126431595 107389832 116227148 115591164 103358246 116846284 110682498 124496120 105646474 112158937 117395003 115980092 111567426 102531707 129972503 ...
result:
ok 4996 numbers
Test #42:
score: -100
Runtime Error
input:
199994 199999 657562 638132 347152 341527 324959 214708 286401 609091 519761 680477 543294 409447 738271 429420 411533 897206 371552 974680 176833 106513 449003 894564 297298 273093 916283 760737 857432 178296 452023 724071 574904 229004 307401 249402 233955 450106 462587 767796 523284 154730 625633...