QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#795448#9634. 序列cly312100 ✓1446ms25452kbC++2010.8kb2024-11-30 20:35:122024-11-30 20:35:12

Judging History

你现在查看的是最新测评结果

  • [2024-11-30 20:35:12]
  • 评测
  • 测评结果:100
  • 用时:1446ms
  • 内存:25452kb
  • [2024-11-30 20:35:12]
  • 提交

answer


#define D90 struct Writer{typedef __int128 mxdouble;template<typename T>typename std::enable_if_t<std::is_class<T>::value,Writer&>operator<<(const T&x){for(auto q:x){*this<<q;if(!is_class<decltype(q)>::value)*this<<print_between;}if(!is_class<typename T::value_type>::value&&print_T_endl)*this<<'\n';return *this;}template<typename...T>Writer&operator<<(const std::tuple<T...>&x){print_tuple<sizeof...(T)>::print(*this,x);if(print_T_endl)*this<<'\n';return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Writer&>operator<<(T x){if(x==0)return putchar('0'),*this;if(x<0)putchar('-'),x=-x;static int sta[45];int top=0;while(x)sta[++top]=x%10,x/=10;while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Writer&>operator<<(T x){if(x<0)putchar('-'),x=-x;x+=pow(10,-print_precision)/2;mxdouble _=x;x-=(T)_;static int sta[45];int top=0;while(_)sta[++top]=_%10,_/=10;if(!top)putchar('0');while(top)putchar(sta[top]+'0'),--top;putchar('.');for(int i=0;i<print_precision;i++)x*=10;_=x;while(_)sta[++top]=_%10,_/=10;for(int i=0;i<print_precision-top;i++)putchar('0');while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Writer&>operator<<(const T&c){putchar(c);return*this;}Writer&operator<<(char*str){int cur=0;while(str[cur])putchar(str[cur++]);return *this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}template<typename T1,typename T2>Writer&operator<<(const std::pair<T1,T2>&x){*this<<x.first<<print_between<<x.second;if(print_T_endl)*this<<'\n';return *this;}Writer&operator<<(const std::string&str){int st=0,ed=str.size();while(st<ed)putchar(str[st++]);return*this;}Writer(){}}cout;}
#define D8F struct Reader{template<typename T>typename std::enable_if_t<std::is_class<T>::value,Reader&>operator>>(T&x){for(auto &y:x)*this>>y;return *this;}template<typename...T>Reader&operator>>(std::tuple<T...>&x){read_tuple<sizeof...(T)>::read(*this,x);return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1;while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}x=0;while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}x*=f;return *this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1,s=0;x=0;T t=0;while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else return x*=f,*this;while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Reader&>operator>>(T&c){c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();return *this;}Reader&operator>>(char*str){int len=0;char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str[len++]=c,c=getchar();str[len]='\0';return*this;}template<typename T1,typename T2>Reader&operator>>(std::pair<T1,T2>&x){*this>>x.first>>x.second;return *this;}Reader&operator>>(std::string&str){str.clear();char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str.push_back(c),c=getchar();return*this;}Reader(){}}cin;const char endl='\n';
#define D8E namespace Fread{const int SIZE=1<<16;char buf[SIZE],*S,*T;inline char getchar(){if(S==T){T=(S=buf)+fread(buf,1,SIZE,stdin);if(S==T)return'\n';}return *S++;}}namespace Fwrite{const int SIZE=1<<16;char buf[SIZE],*S=buf,*T=buf+SIZE;inline void flush(){fwrite(buf,1,S-buf,stdout);S=buf;}inline void putchar(char c){*S++=c;if(S==T)flush();}struct NTR{~NTR(){flush();}}ztr;}
#define D8D clock_t time_last;time_helper(){time_last=clock();}void test(){auto time_now=clock();std::cerr<<"time:"<<1.*(time_now-time_last)/CLOCKS_PER_SEC<<";all_time:"<<1.*time_now/CLOCKS_PER_SEC<<std::endl;time_last=time_now;}~time_helper(){test();}
#define D8C std::tuple<T...>&x){print_tuple<id-1>::print(stream,x);putchar(print_between);stream<<get<id-1>(x);}};template<>struct
#define D8B read(Reader&stream,std::tuple<T...>&x){read_tuple<id-1>::read(stream,x);stream>>get<id-1>(x);}};template<>struct
#define D8A value=(std::is_integral<T>::value||std::is_same<T,__int128>::value)&&!is_char<T>::value;};template<typename
#define D89 read([[maybe_unused]]Reader&stream,[[maybe_unused]]std::tuple<T...>&x){}};template<size_t
#define D88 value=std::is_floating_point<T>::value||std::is_same<T,__float128>::value;};namespace
#define D87 cin>>a[x],bl[x]=(x-1)/B+1,L[bl[x]]=(bl[x]==bl[x-1]?L[bl[x]]:x),R[bl[x]]=x;
#define D86 int print_precision=10;bool print_T_endl=1;char print_between=' ';
#define D85 y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));}
#define D84 std::tuple<T...>&x){stream<<get<0>(x);}};template<>struct
#define D83 value=(std::is_same<T,char>::value||std::is_same<T,signed
#define D82 print([[maybe_unused]]Writer&stream,[[maybe_unused]]const
#define D81 b0[y+L[x]-1]+=tag1[x][y]+tag2[x][y]*premx[y+L[x]-1];
#define D80 pos=lower_bound(premx+L[x],premx+R[x]+1,mx)-premx;
#define D7F sufsum[y]=y==R[x]?premx[y]:sufsum[y+1]+premx[y];
#define D7E std::forward<Args>(args)...);}};template<class
#define D7D tag1[N/B+5][B+5],tag2[N/B+5][B+5],sum[N/B+5];
#define D7C a[N+5],L[N/B+5],R[N/B+5],bl[N+5],premx[N+5];
#define D7B print_tuple<1>{template<typename...T>static
#define D7A print_tuple<0>{template<typename...T>static
#define D79 premx[y]=y==L[x]?a[y]:max(a[y],premx[y-1]);
#define D78 read_tuple<0>{template<typename...T>static
#define D77 print_tuple{template<typename...T>static
#define D76 read_tuple{template<typename...T>static
#define D75 sum[x]+=1ll*mx*(pos-L[x])+sufsum[pos];
#define D74 char>::value||std::is_same<T,unsigned
#define D73 mx=max(mx,a[x]),b0[x]+=mx,sum[b]+=mx;
#define D72 memset(tag1[x],0,sizeof(tag1[x]));
#define D71 memset(tag2[x],0,sizeof(tag2[x]));
#define D70 char>::value);};template<typename
#define D6F if(bl[l]==bl[r])brute(l,r,mx);
#define D6E is_floating_point_ex{static
#define D6D fun_;public:template<class
#define D6C fun_(std::forward<T>(fun))
#define D6B tc=1;tc<=t;tc++)solve(tc);
#define D6A tag2[x][y]+=tag2[x][y-1],
#define D69 tag1[x][y]+=tag1[x][y-1],
#define D68 print(Writer&stream,const
#define D67 x=bl[l]+1;x<=bl[r]-1;x++)
#define D66 solve([[maybe_unused]]int
#define D65 ans+=bruteq(L[bl[r]],r);
#define D64 tag1[x][pos-L[x]+1]-=mx;
#define D63 std::tuple<T...>&x){}};
#define D62 ans=bruteq(l,R[bl[l]]);
#define D61 y_combinator_result{Fun
#define D60 y=1;y<=R[x]-L[x]+1;y++)
#define D5F tag2[x][pos-L[x]+1]++;
#define D5E Writer;template<size_t
#define D5D ...Args>decltype(auto)
#define D5C brute(L[bl[r]],r,mx);
#define D5B brute(l,R[bl[l]],mx);
#define D5A is_integral_ex{static
#define D59 fun_(std::ref(*this),
#define D58 y_combinator_result(T
#define D57 sum[x]+=sufsum[L[x]];
#define D56 sufsum[N+5],b0[N+5];
#define D55 y=L[x];y<=R[x];y++)
#define D54 y=R[x];y>=L[x];y--)
#define D53 if(premx[R[x]]<=mx)
#define D52 if(premx[L[x]]>=mx)
#define D51 Fun>decltype(auto)
#define D50 sum[x]+=1ll*mx*B;
#define D4F template<typename
#define D4E x=1;x<=bl[n];x++)
#define D4D &&...args){return
#define D4C if(bl[l]==bl[r])
#define D4B if(l>r)continue;
#define D4A cout<<ans<<endl;
#define D49 {}template<class
#define D48 y_combinator(Fun
#define D47 ans=bruteq(l,r);
#define D46 mx=premx[R[x]];
#define D45 B=500,N=500000;
#define D44 operator()(Args
#define D43 tag1[x][1]+=mx;
#define D42 cin>>op>>l>>r;
#define D41 template<class
#define D40 is_char{static
#define D3F }time_helper;
#define D3E x=l;x<=r;x++)
#define D3D tag2[x][1]++;
#define D3C &&fun){return
#define D3B Fastio{struct
#define D3A Reader;struct
#define D39 apply(bl[l]);
#define D38 apply(bl[r]);
#define D37 build(bl[l]);
#define D36 x=1;x<=n;x++)
#define D35 ans+=sum[x];
#define D34 time_helper{
#define D33 init();void
#define D32 res+=b0[x];
#define D31 cin>>n>>m;
#define D30 bruteq(int
#define D2F while(m--)
#define D2E T>explicit
#define D2D init();int
#define D2C apply(int
#define D2B if(op==3)
#define D2A solve(int
#define D29 if(op==2)
#define D28 constexpr
#define D27 brute(int
#define D26 build(x);
#define D25 id>struct
#define D24 Fun>class
#define D23 build(int
#define D22 if(op==1)
#define D21 namespace
#define D20 r,int&mx)
#define D1F b=bl[l];
#define D1E __int128
#define D1D test(){}
#define D1C T>struct
#define D1B for(int
#define D1A a[l]=r;
#define D19 &&fun):
#define D18 op,l,r;
#define D17 return
#define D16 struct
#define D15 res=0;
#define D14 ans=0;
#define D13 init()
#define D12 main()
#define D11 l,int
#define D10 mx=0;
#define DF using
#define DE else
#define DD std;
#define DC bool
#define DB long
#define DA void
#define D9 n,m;
#define D8 tc);
#define D7 res;
#define D6 t=1;
#define D5 tc)
#define D4 int
#define D3 x)
#define D2 r)
#define D1 {
#define D0 }
#include <time.h>
#include<bits/stdc++.h>
#define D91 DF D21 DD D16 D34 
#define D92(__FOX__) __FOX__
D92(D91)
#ifdef LOCAL
#define D93 D8D 
#define D94(__FOX__) __FOX__
D94(D93)
#else
#define D95 DA D1D 
#define D96(__FOX__) __FOX__
D96(D95)
#endif
#define D97 D3F 
#define D98(__FOX__) __FOX__
D98(D97)
#ifdef LOCAL
#include"dbg.h"
#else
#define dbg(...) (__VA_ARGS__)
#endif
#define D99 D8E 
#define D9A(__FOX__) __FOX__
D9A(D99)
#define getchar Fread::getchar
#define putchar Fwrite::putchar
#define D9B D86 D4F D1C D40 D28 DC D83 D74 D70 D1C
#define D9C D5A D28 DC D8A D1C D6E D28 DC D88 D3B
#define D9D D3A D5E D25 D76 DA D8B D78 DA D89 D25
#define D9E D77 DA D68 D8C D7B DA D68 D84 D7A DA
#define D9F D82 D63 D8F D90 
#define DA0 D9B D9C D9D D9E D9F 
#define DA1(__FOX__) __FOX__
DA1(DA0)
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
#define DA2 D41 D24 D61 D6D D2E D58 D19 D6C D49 D5D
#define DA3 D44 D4D D59 D7E D51 D48 D3C D85 DA D33
#define DA4 D2A D8 D12 D1 D2D D6 D1B D6B D0 DA
#define DA5 D13 D1 D0 D28 D4 D45 D4 D7C DB DB
#define DA6 D56 DA D23 D3 D1 D1B D55 D79 D1B D54
#define DA7 D7F D0 DB DB D7D DA D2C D3 D1 D1B
#define DA8 D60 D69 D6A D81 D72 D71 D0 DA D27 D11
#define DA9 D20 D1 D4 D1F D1B D3E D73 D0 DB DB
#define DAA D30 D11 D2 D1 DB DB D15 D1B D3E D32
#define DAB D17 D7 D0 DA D66 D5 D1 D4 D9 D31
#define DAC D1B D36 D87 D1B D4E D26 D2F D1 D4 D18
#define DAD D42 D22 D1 D39 D1A D37 D0 D4B D29 D1
#define DAE D4 D10 D6F DE D1 D5B D1B D67 D1 D53
#define DAF D1 D43 D50 D0 DE D52 D1 D3D D57 D46
#define DB0 D0 DE D1 D4 D80 D43 D64 D5F D75 D46
#define DB1 D0 D0 D5C D0 D0 D2B D1 D1E D14 D4C
#define DB2 D1 D39 D47 D0 DE D1 D39 D38 D62 D1B
#define DB3 D67 D35 D65 D0 D4A D0 D0 D0 
#define DB4 DA2 DA3 DA4 DA5 DA6 DA7 DA8 DA9 DAA DAB
#define DB5 DAC DAD DAE DAF DB0 DB1 DB2 DB3 
#define DB6 DB4 DB5 
#define DB7(__FOX__) __FOX__
DB7(DB6)

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 0ms
memory: 14012kb

input:

1000 1000
200255705 18851142 736009342 406246331 351992319 749189355 944184790 785599293 530084396 616825582 73892135 176401717 973078957 225462579 140426746 324124972 229974996 750749128 879242920 854856469 515750108 662437499 10800517 96488944 534239216 379225718 1241451 150390174 183892560 613018...

output:

115323323048
65823230682
0
47168872319
60782985614
348599053983
918484726470
208925010382
841530027736
1163442457471
2608439690799
2128414546126
2471685184070
2278023608377
4122371223088
1458343349705
62968981524
4425943072510
5286986186209
537921635417
6006016656637
6374912810574
4556755081981
4090...

result:

ok 319 lines

Test #2:

score: 5
Accepted
time: 2ms
memory: 13944kb

input:

675 498
75499042 789966903 502155346 54108007 467143562 114588937 94686746 295185255 554039744 259329427 158379833 138282372 561461541 957169421 692456397 450721274 101897728 872864525 297269606 128259204 146200569 334256573 638122576 708088255 258863311 783805088 186494595 159493286 860425671 36583...

output:

3210556218
191560004083
104947218282
135015954140
89106128730
315174748560
850455290830
215793984626
105038927720
671668276124
293473436208
1370960719682
307802923002
1044297322034
471948015606
1812945110331
509687537766
877665782562
5988747959725
2402086669705
665467763330
3875485682146
30788930819...

result:

ok 157 lines

Test #3:

score: 5
Accepted
time: 0ms
memory: 13964kb

input:

832 956
63423286 492662095 483038836 43381328 710704754 275209586 772971912 639125432 123099101 440862460 183294225 125906357 452957650 331299449 449896214 12572018 605185437 64801748 40959720 490409349 609153090 532014716 503601695 886231182 433385802 11363084 17467752 140921783 203238927 515442553...

output:

159703328433
728165156759
460962189958
139692978146
459083548685
2010218005483
160646809572
1998558719788
2532122916025
208715188685
3433514558392
1245744189229
2304867462814
1101186845031
4646172459091
3539374659926
2219710349880
2981467606232
1639756233272
3123456308009
129830992916
2707661776087
...

result:

ok 298 lines

Test #4:

score: 5
Accepted
time: 0ms
memory: 14004kb

input:

107 458
539936263 550880224 110849701 171862479 40453865 42606847 118258420 901511714 62978713 994457516 790180985 231543035 67333164 220103435 863166805 693458691 735393617 656359198 456294870 483207020 36257117 51902430 86590102 656792972 473981545 132412739 956528165 655526259 389318494 722510414...

output:

37703321582
61151152486
38167350208
27335153157
13391394310
39026827445
9471505258
132653861927
53752862940
55529822900
30680946663
4850841785
63192296538
51576868617
68746826458
72693752015
9960381094
54341149280
153650643409
85423704752
30991460260
76087303259
206268124856
210773791402
16018411054...

result:

ok 147 lines

Test #5:

score: 5
Accepted
time: 0ms
memory: 13924kb

input:

933 247
290494705 534765936 691140472 652599148 796414457 950767936 884921919 736175995 398100604 985864598 604544799 325091836 100139758 78534816 237456204 966229805 77069564 843105831 62870326 241741343 997490857 25434019 587844838 826260504 87495532 783942134 938382330 817416196 861328912 8872012...

output:

527080492570
170522861753
35492358564
1118019649402
1245650784268
517846428173
157238640740
64050364170
1165387164835
797344988879
905518201748
585830293577
1469275121374
2090399342887
993895826760
563204905613
2275566746139
891332495993
510813367529
3220707417878
4014471703279
1232981799608
1788988...

result:

ok 88 lines

Subtask #2:

score: 15
Accepted

Test #6:

score: 15
Accepted
time: 173ms
memory: 15728kb

input:

100000 100000
4637 12023 22485 24887 33065 35780 37538 49402 71281 72891 82706 82752 91276 108256 240372831 135259 144119 527163065 139510686 183411 214260 269767144 246850 265137 200716505 279533 283217 309516 310867 466875375 322790 328304 352577 362081 368658 370430 393854 410075 413844 417924 42...

output:

0
30726293751614
23279151095632
41852587040702
88334302224542
55145178872681
133708315362378
122479400900129
51466277782595
118512887868405
11037534475440
65035924904178
10603452209550
199208093593954
265893836606312
214479670680947
204140164589562
309440794035363
371664753856955
431192829952188
223...

result:

ok 33171 lines

Test #7:

score: 15
Accepted
time: 178ms
memory: 22808kb

input:

100000 100000
19723 39392 45074 51502 53631 57384 62795 83715 87504 89050 841832193 866044146 107373 108026 345025215 112030 116974 122686 123235 148805 149471 956007390 165128 786395423 169262 171279 178785 179135 179363 180975 182200 187213 212008 217112 218394 221491 233714 819427472 238361 24227...

output:

0
32124614467875
69730586575982
15351815760648
39463147851339
16268178614557
303342370917063
346244985109518
292833305376516
352153160757784
158244261040178
599241224673877
67404589393329
432694296417372
124742290707994
314297538152335
495171088283939
417004525148234
143916527742938
338939254812923
...

result:

ok 33331 lines

Test #8:

score: 15
Accepted
time: 86ms
memory: 22712kb

input:

100000 100000
2908 10473 29474 35649 40424 46783 50041 68445 81098 96582 90025 102538 128766 120910 131449 149397 169408 167938 187128 192288 196084 207953 217258 231306 247570 248623 250548 266615 274685 296144 299431 306652 323405 326332 341744 340727 363155 376283 381987 389450 398454 406178 4118...

output:

377915538139549
79386636621796
310648735973954
1115465766317781
1174759112421105
1267214610548620
144309126675820
791491017938869
790485778190958
1992438100036954
3728927904532942
3450408776333060
1148459259855542
3434668196031763
1429031077622813
4384069058754410
4712920036420316
1905079428498382
1...

result:

ok 4980 lines

Test #9:

score: 15
Accepted
time: 188ms
memory: 19652kb

input:

100000 100000
1 5416 10193 20973 43641 59111 59710 61214 83161 89367 92875 103278 120697 123362 132339 144415 150301 177312 177726 186305 198765 215887 229844 225598 243960 243968 253899 264297 270663 295463 297815 313600 322370 325050 339675 343618 366146 371128 372853 399869 392890 416762 427071 4...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
12506289774675
30993852542994
1476270298068
19859163976805
256593130788
4863792552078
36510986090424
0
8793244932194
0
27496507734929
46196387428852
10116507432109
39651727981238
9881579282058
47734322666145
9721472071510
13783772572906
49612189104874
34561802750647
709...

result:

ok 90082 lines

Test #10:

score: 15
Accepted
time: 256ms
memory: 19708kb

input:

100000 100000
1 19147 10463 34611 35980 52756 56153 69683 88615 99259 98503 116764 125535 124685 147668 148442 165440 179502 177942 189770 192749 210988 225546 239486 239605 256115 254808 277994 280096 281446 304064 310129 314591 338439 341802 353959 354678 367015 375732 388669 401837 415599 425050 ...

output:

0
0
4895336576636
24273351987479
0
29184129318917
6733439631000
0
22091734242466
0
30621121378918
9663021894490
10825012438813
16599195369255
18919747078225
70174059707617
106918147267604
162528871022197
91971637270994
110828263125883
184744551106766
39546233888866
135239194093210
136071671449847
18...

result:

ok 4885 lines

Subtask #3:

score: 20
Accepted

Test #11:

score: 20
Accepted
time: 376ms
memory: 24664kb

input:

199996 199998
5015 394604305 13416 39971157 16609 21608 24264 407389425 31670 31976 33151 38949 39093 43561 45026 52355 53865 59168 62183 64166 66110 67179 69567 78899 10409535 393971884 104797 109461 109501 114704 118658 123559 123907 130465 131312 140968 144801 146183 157067 160370 796894425 17818...

output:

124830885330445
163133190457804
21829962212270
97332810213576
143489565142015
101516391700168
11850432340486
170205236804236
447031192227296
157109166149152
992595580711424
2459784243144
90627247023452
229326680354895
929560394107059
338204574812304
609780011775761
527358703064443
385256587900185
16...

result:

ok 66818 lines

Test #12:

score: 20
Accepted
time: 391ms
memory: 21412kb

input:

199998 199999
168 3359 6105 15486 21875 25864 26468 30351 43952 43989 53793 53923 61996 63968 65630 70205 78972 81963 94601 94496 96858 109506 114092 118673 120001 125356 130839 134104 143348 141897 151011 153528 157134 164610 167357 171010 177495 186843 193531 193638 201233 202713 208183 212666 223...

output:

0
4378051270375
0
6903808423403
13362901828733
18444776076770
24372543933372
158384277197471
6735580542339
25778920050816
111413592672333
200397968479242
143113451226432
205402754231468
0
434973423866394
42704336802074
442387964318825
171170830546889
18443266342726
582023884944817
819893988905193
94...

result:

ok 66333 lines

Test #13:

score: 20
Accepted
time: 534ms
memory: 21276kb

input:

199996 199998
1 8536 12954 19783 24275 23112 27131 34314 36101 42615 48466 55598 62138 62041 66894 76298 80786 83532 94549 95266 99934 103499 106876 115843 124352 125509 131309 133329 142222 147539 148560 151511 159600 163448 171677 174052 178953 184230 188029 193110 199225 203957 211003 214530 2173...

output:

0
0
0
0
14230186293404
15014710688740
69339379467107
157959280933497
124274051765400
86841342219535
125440741040951
374686462687449
1769370913820
224600387765048
108156479666221
3476736401531
4338871624824
29506026393352
358909490712855
246444614376890
159607092663372
143268992784813
674698942075974...

result:

ok 10049 lines

Test #14:

score: 20
Accepted
time: 220ms
memory: 24964kb

input:

199999 199997
1 4065 13359 10483 20784 20157 25556 39760 41476 45884 52871 54407 55577 65959 69590 74858 81749 86436 91329 98879 97009 105999 113477 117069 116743 122114 126146 134968 141127 149818 150629 157016 159290 169139 168704 174398 182101 189350 188710 190054 195317 202111 208298 213463 2184...

output:

356664773280160
271576584537205
327103957637028
2437225740748747
424187891897923
3136989129319026
1823818488324464
2616111643348778
1096269625861496
101009675213988
4940972090515486
6514435670175637
7612523705881197
2639797844667310
4384189184591598
962636216165669
4693306475088573
9631726489351068
...

result:

ok 9919 lines

Test #15:

score: 20
Accepted
time: 399ms
memory: 21284kb

input:

199998 199996
1 487 6502 19580 16435 25298 31247 31018 40108 40947 54517 56109 57587 66623 72598 78065 75147 80358 87866 91253 103921 106603 112657 119454 115153 123264 126135 139643 142286 146464 148647 158426 160574 167320 167984 172186 184199 182075 188571 196590 201899 204304 210013 217785 21714...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
52089694319421
5136957493076
3450951990644
61850716056488
31244298493786
21509654027244
80848058425062
38845223723325
84427687790134
42434414680971
78744664386759
44358604063388
59495332272505
93887268574436
11926208216313
8042283208270
84995354850496
65164553742256
138...

result:

ok 179917 lines

Subtask #4:

score: 20
Accepted

Test #16:

score: 20
Accepted
time: 1158ms
memory: 25300kb

input:

499996 499997
1 2646 3802 4717 7652 9462 10048 15736 15959 17076 21684 21628 25147 26990 26023 28835 33604 34213 36006 39643 38238 40133 45193 44699 47403 48437 51742 53992 57055 56322 61353 61812 62008 67837 66136 70512 72503 72294 75169 77534 81608 80173 85831 85776 87518 89661 93233 93800 96640 9...

output:

0
0
0
0
0
105147493356021
18039314547119
60123011205734
797041402206
80680889110877
0
97607273260486
71194267494796
23670063883525
92041637115786
11373629471803
104829243846562
112256838369147
16646163554581
83634910857933
110480671764271
2174900945295
97605316257427
25997394270292
1924389041448
137...

result:

ok 450128 lines

Test #17:

score: 20
Accepted
time: 1310ms
memory: 25332kb

input:

499998 499996
1 3471 2549 4182 8919 10258 11561 15179 16303 17220 20893 23445 24991 27357 26370 28731 30556 35428 37486 37835 39061 43719 43122 44729 48319 51703 50012 52147 57593 57437 61479 63875 64817 67167 67191 69596 70253 73553 76856 76030 78391 83022 82701 87998 88253 90359 92016 93464 96464 ...

output:

1293275144175713
2098057486611995
8222351022350847
17610615352954277
6318371993395498
13728539476460850
6533073631723592
14700814893017093
21018382511562240
5631782124013074
6045739759458044
32012453560709915
4647695248557350
33891352492409939
25680366630303673
30384715040873579
21745305855945815
23...

result:

ok 24988 lines

Test #18:

score: 20
Accepted
time: 1446ms
memory: 25384kb

input:

500000 500000
608 738 5752 5292 8293 10892 13927 15776 16198 16191 20464 21616 25835 27728 29600 30512 32500 35775 35143 38512 41145 42371 42156 47505 46144 51146 52247 52850 56466 56682 58346 60210 65148 65708 66678 68409 71464 74865 76026 77232 79208 82335 85155 87096 87571 90415 91796 93048 94146...

output:

97428106516000
25769921122339
15565109049408
547971828948550
94732538907356
472882254783045
156004859076725
464118008807453
1822683869008643
1889575991805360
356261766009175
1585299799977763
1663349592641455
459724606138757
712018902269810
1325626707950618
944427429986067
1495296925408453
1756194602...

result:

ok 25346 lines

Subtask #5:

score: 20
Accepted

Test #19:

score: 20
Accepted
time: 840ms
memory: 25392kb

input:

499999 499997
1 913 5858 7110 8076 9893 13142 12135 14769 16455 20711 22647 22330 25867 26677 28695 32280 33608 34824 39255 40515 43887 42090 46155 49082 48316 50861 55535 54485 56506 59203 61928 62076 66600 68030 69805 72680 74796 75455 79690 78235 83297 82398 85367 87069 89711 93646 92554 95923 97...

output:

103621325428465
194930859933753
353758078534853
1405031453939581
1104512586294893
480139615473767
1033865068621131
1418492876310288
1129269195811974
845644688375455
3918331221480338
4521399133967034
482692294649644
1270881159480750
2064526258912334
7779855812924988
5610050149593744
1191164601160151
...

result:

ok 50138 lines

Test #20:

score: 20
Accepted
time: 1120ms
memory: 25420kb

input:

499999 499997
1 2213 5473 4954 7847 9606 11538 14713 16967 17231 19298 22038 24335 27347 27494 29744 30464 34822 34258 36734 40367 40233 42172 46878 46491 51842 52641 55623 57936 59072 58266 60645 62526 66217 66814 69665 72879 75341 77127 77547 79941 82485 85033 86079 88755 91591 91520 95447 94167 9...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
81057716283769
0
58160405454429
81057716283769
0
38762933103380
0
0
0
0
19786716248757
51420496190610
80019121573890
0
0
0
81057716283769
81057716283769
81057716283769
21969113684487
18463719510174
134196388531124
58717732732408
0
24024948307278
2157493246347
668684594289...

result:

ok 450371 lines

Test #21:

score: 20
Accepted
time: 1094ms
memory: 25312kb

input:

499996 499998
3381 3593 4113 4972 6162 8288 8360 13902 14835 498924898 17603 17617 18716 19906 21099 25972 28557 834698271 29164 29924 31699 33440 33707 37983 38010 40160 44872 46219 51029 51795 51835 53749 57096 57283 58384 58961 59115 65629 65701 68621 71246 71780 73880 75706 76933 78517 80261 806...

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
23965463250225
0
0
0
23965463250225
309442590643365
57445637795688
326745362840192
0
459811972206365
201912861761808
50675305228852
461625897616499
35135042533500
57540793244672
539870680136987
275275456575408
368030974612952
200417050134300
9093...

result:

ok 450104 lines

Test #22:

score: 20
Accepted
time: 678ms
memory: 25408kb

input:

500000 499997
3741 3815 4672 5067 8853 17955 21209 22153 24666 27033 27266 29827 30335 30508 31044 31773 33818 33968 34956 541779339 37867 828437734 45398 45448 46370 49840 50213 50234 53238 55069 56809 60121 60221 60980 61282 61618 67376 71708 75596 79839 79839 85233 87694 91896 93863 96295 97238 9...

output:

66651161114854
458153118035488
3717015342581771
4335792914160139
5924851654064386
1879498468437056
4176755480685838
10174168959162075
3065202311146763
8233736924695588
19522657770554156
16591170788134589
4420681049603341
6616038244450181
18166305555720758
21408659482937484
17893622621312470
33051122...

result:

ok 49981 lines

Subtask #6:

score: 20
Accepted

Test #23:

score: 20
Accepted
time: 1142ms
memory: 25320kb

input:

500000 499997
811 680 2664 6777 6210 8794 10852 13568 17252 18119 19538 22423 23434 24510 27591 29645 31329 33806 37129 37447 40339 41361 45606 47813 47448 50532 50029 53543 54938 56738 59038 63199 62439 67323 68737 71432 71039 75469 76122 79648 80334 81276 84567 85506 89609 91503 91445 94036 97338 ...

output:

0
0
46530827437710
159760134281336
281467808921043
372576789411254
270515121922085
273418740230876
314163853033674
465151417299684
39902282964668
608644183868574
3945842783692
13545278446404
658747128786432
8688035320113
175738882065799
103795597112962
0
751662464688101
182137815371386
3400806326455...

result:

ok 166681 lines

Test #24:

score: 20
Accepted
time: 1404ms
memory: 25396kb

input:

500000 499999
1 1639 2201 6285 6215 8125 13710 12988 14315 18601 20990 22580 23997 24514 29257 31227 33478 35662 37133 37468 40238 42716 42669 44490 46121 48229 52209 55340 57798 58541 60730 63021 64811 66345 69591 68817 72659 74529 74929 76669 80546 82212 82768 86216 86293 91460 91504 92138 95157 9...

output:

0
0
0
0
0
7479612283419
82116375190942
332869083724006
60660028936894
424698907614340
2559412955730
144317899965851
185416679502679
217947064400012
196185845398010
1008936990942588
232090235683219
783696796163914
9892924046232
691220714731528
877968283407126
576179696574274
201064576343363
403551744...

result:

ok 24777 lines

Test #25:

score: 20
Accepted
time: 844ms
memory: 25452kb

input:

499999 499999
1 1419 3726 6756 8528 11673 13205 12155 14980 18964 21212 20901 24639 27956 28458 30505 31871 35372 34868 36678 39179 43774 45374 44545 49096 48220 52693 55504 56308 59040 60542 62702 65989 67380 67677 70672 70576 73160 76650 78785 81804 80239 85338 84465 87958 88580 92545 92257 95026 ...

output:

720694455820917
442248038398282
650279539169003
7455078395532627
284470851618358
3754049793299482
9936213161891434
8475746238550451
14137066705532647
9691013563924394
3590372039698479
215416716442132
9233208269323562
7397807890442702
23280972137769835
1316145046409180
22394094496963489
7163501580626...

result:

ok 25103 lines

Test #26:

score: 20
Accepted
time: 1111ms
memory: 25396kb

input:

499998 499998
993 2241 4369 5999 9927 11751 10550 15891 17715 16844 19009 21329 23705 27939 29855 30802 30879 33817 35869 38473 41427 41850 42924 45834 49832 50272 53224 55568 55404 59523 60631 61183 65831 64669 66278 69630 70422 74282 75242 77735 79550 82125 83928 86911 88677 91591 90846 94859 9612...

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
1852910986913
0
0
12901813174638
108672559935992
144598437591217
0
27787918389245
158053668431882
144309139463173
14834470974318
190395778705067
158974198751601
13826610010158
2016...

result:

ok 450172 lines