QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#772812#7449. rgxsxrsZaunese100 ✓5404ms20968kbC++146.0kb2024-11-22 22:04:132024-11-22 22:04:14

Judging History

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

  • [2024-11-22 22:04:14]
  • 评测
  • 测评结果:100
  • 用时:5404ms
  • 内存:20968kb
  • [2024-11-22 22:04:13]
  • 提交

answer

//                              -    주의 만세!

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<climits>

#define fi first
#define se second
#define mkp std::make_pair
using llu=long long unsigned;
using ll=long long;
using std::max;
using std::min;
template<class T> void cmax(T&a,T b){a=max(a,b);}
template<class T> void cmin(T&a,T b){a=min(a,b);}

namespace io{//{{{
	const int __SIZE=(1<<21)+1;
	char ibuf[__SIZE],*iS,*iT,obuf[__SIZE],*oS=obuf,*oT=oS+__SIZE-1,__c,qu[55];int __f,qr,_eof;
	#define Gc()(char)(iS==iT?(iT=(iS=ibuf)+fread(ibuf,1,__SIZE,stdin),(iS==iT?EOF:*iS++)):*iS++)
	inline void flush(){fwrite(obuf,1,oS-obuf,stdout),oS=obuf;}
	inline void gc(char&x){x=Gc();}
	inline void pc(char x){*oS++=x;if(oS==oT)flush();}
	inline void pstr(const char*s){int __len=(int)strlen(s);for(__f=0;__f<__len;++__f)pc(s[__f]);}
	inline void gstr(char*s){for(__c=Gc();__c<32||__c>126||__c==' ';)__c=Gc();
		for(;__c>31&&__c<127&&__c!=' '&&__c!='\n'&&__c!='\r';++s,__c=Gc())*s=__c;
        *s=0;}
	template<class I>inline bool gi(I&x){_eof=0;
		for(__f=1,__c=Gc();(__c<'0'||__c>'9')&&!_eof;__c=Gc()){if(__c=='-')__f=-1;_eof|=__c==EOF;}
		for(x=0;__c<='9'&&__c>='0'&&!_eof;__c=Gc())x=x*10+(__c&15),_eof|=__c==EOF;
        x*=__f;return!_eof;}
	template<class I>inline void pi(I x){if(!x)pc('0');if(x<0)pc('-'),x=-x;
		while(x)qu[++qr]=x%10+'0',x/=10;
        while(qr)pc(qu[qr--]);}
    template<class I>inline void pil(I x){pi(x);pc(10);}
    template<class I>inline void pis(I x){pi(x);pc(32);}
	struct Flusher_{~Flusher_(){flush();}}io_flusher_;
}using io::gi;using io::pi;using io::pis;using io::pil;//}}}

const int INF=INT_MAX;
ll lb[9],rb[9];
int getb(int x){
    int ans=1;
    while(x>rb[ans]) ++ans;
    return ans;
}
const int NV=5e5;
const int B=16;
int N,a[NV+5];

namespace seg{
    const int L=32;
    struct SEGN{
        ll s,taf,cn;
        int mx,mn;
    } tr[9][40005];
    void up(int b,int x){
        tr[b][x].s=tr[b][x*2].s+tr[b][x*2+1].s;
        tr[b][x].cn=tr[b][x*2].cn+tr[b][x*2+1].cn;
        tr[b][x].mx=max(tr[b][x*2].mx,tr[b][x*2+1].mx);
        tr[b][x].mn=min(tr[b][x*2].mn,tr[b][x*2+1].mn);
    }void dn(int b,int x){
        if(!tr[b][x].taf) return;
        ll taf=tr[b][x].taf;
        if(tr[b][x*2].cn){
            tr[b][x*2].taf+=taf;
            tr[b][x*2].s-=taf*tr[b][x*2].cn;
            tr[b][x*2].mx-=taf;
            tr[b][x*2].mn-=taf;
        }
        if(tr[b][x*2+1].cn){
            tr[b][x*2+1].taf+=taf;
            tr[b][x*2+1].s-=taf*tr[b][x*2+1].cn;
            tr[b][x*2+1].mx-=taf;
            tr[b][x*2+1].mn-=taf;
        }
        tr[b][x].taf=0;
    }void bfdn(int b,int l,int r,ll&z){
        if(!z) return;
        for(int i=l;i<=r;++i) if(lb[b]<=a[i]&&a[i]<=rb[b]) a[i]-=z;
        z=0;
    }void bfup(int b,int x,int l,int r){
        tr[b][x].cn=tr[b][x].s=tr[b][x].mx=0;
        tr[b][x].mn=INF;
        for(int i=l;i<=r;++i) if(lb[b]<=a[i]&&a[i]<=rb[b]){
            ++tr[b][x].cn;
            tr[b][x].s+=a[i];
            cmax(tr[b][x].mx,a[i]);
            cmin(tr[b][x].mn,a[i]);
        }
    }void ins(int b,int x,int l,int r,int p,int z){
        if(r-l+1<=L){
            bfdn(b,l,r,tr[b][x].taf);
            a[p]=z;
            bfup(b,x,l,r);
            return;
        }
        int mid=l+r>>1;
        dn(b,x);
        if(p<=mid) ins(b,x*2,l,mid,p,z);
        else ins(b,x*2+1,mid+1,r,p,z);
        up(b,x);
    }void add(int b,int x,int l,int r,int ql,int qr,int z){
        if(tr[b][x].mx<=z) return;
        if(r-l+1<=L){
            bfdn(b,l,r,tr[b][x].taf);
            for(int i=max(l,ql);i<=min(r,qr);++i) if(lb[b]<=a[i]&&a[i]<=rb[b])
                if(a[i]>z){
                    a[i]-=z;
                    if(a[i]<lb[b]) ins(getb(a[i]),1,1,N,i,a[i]);
                }
            bfup(b,x,l,r);
            return;
        }
        if(ql<=l&&r<=qr&&tr[b][x].mn-z>=lb[b]){
            tr[b][x].mn-=z;
            tr[b][x].mx-=z;
            tr[b][x].taf+=z;
            tr[b][x].s-=z*tr[b][x].cn;
            return;
        }
        int mid=l+r>>1;
        dn(b,x);
        if(ql<=mid) add(b,x*2,l,mid,ql,qr,z);
        if(mid<qr) add(b,x*2+1,mid+1,r,ql,qr,z);
        up(b,x);
    }void que(int b,int x,int l,int r,int ql,int qr,ll&sum,int&mx,int&mn){
        if(ql<=l&&r<=qr){
            sum+=tr[b][x].s;
            cmax(mx,tr[b][x].mx);
            cmin(mn,tr[b][x].mn);
            return;
        }
        if(r-l+1<=L){
            bfdn(b,l,r,tr[b][x].taf);
            for(int i=max(l,ql);i<=min(r,qr);++i) if(lb[b]<=a[i]&&a[i]<=rb[b]){
                sum+=a[i];
                cmax(mx,a[i]);
                cmin(mn,a[i]);
            }
            bfup(b,x,l,r);
            return;
        }
        int mid=l+r>>1;
        dn(b,x);
        if(ql<=mid) que(b,x*2,l,mid,ql,qr,sum,mx,mn);
        if(mid<qr) que(b,x*2+1,mid+1,r,ql,qr,sum,mx,mn);
        up(b,x);
    }
}

namespace xm{
    void _(){
        for(int i=1;i<=8;++i)
        for(int j=0;j<40005;++j) seg::tr[i][j].mn=INF;

        int Q;

        gi(N);
        gi(Q);
        for(int i=1;i<=8;++i){
            lb[i]=rb[i-1]+1;
            rb[i]=lb[i]*B-1;
        }
        for(int i=1;i<=N;++i){
            gi(a[i]);
            seg::ins(getb(a[i]),1,1,N,i,a[i]);
        }

        int lastans=0;
        while(Q--){
            int op,l,r;
            gi(op);
            gi(l);
            gi(r);
            l^=lastans;
            r^=lastans;
            if(op==1){
                int x;
                gi(x);
                x^=lastans;
                for(int i=1;i<=8;++i) if(rb[i]>=x) seg::add(i,1,1,N,l,r,x);
            }else{
                ll sum=0;
                int mx=0,mn=INF;
                for(int i=1;i<=8;++i) seg::que(i,1,1,N,l,r,sum,mx,mn);
                pis(sum);
                pis(mn);
                pil(mx);
                lastans=sum%(1<<20);
            }
        }
    }
}

int main(){
    xm::_();
    return 0;
}

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 5ms
memory: 16400kb

input:

1000 1000
935816535 513713699 701239859 881761843 312245068 749043434 112422339 4851733 369182510 741607986 336173081 76013815 91837056 23042507 28754006 935721035 332487169 739344582 280604892 549629633 428486579 693745524 772744523 736620619 596867287 553364838 842666116 620926490 350404590 972861...

output:

265016378473 746807 999055631
666065535 666065535 666065535
271006237166 746807 999055631
244146031651 726339 992039812
15823858743 7712227 991422034
1807891893 93288403 840436769
17240518274 746807 968670509
110636754727 726339 817084515
57343541330 746807 806807028
41246731402 746807 770270334
588...

result:

ok 1575 numbers

Subtask #2:

score: 20
Accepted

Test #2:

score: 20
Accepted
time: 317ms
memory: 18736kb

input:

200000 200000
10 7 6 1 5 5 10 1 9 4 7 1 5 4 8 9 5 7 10 2 10 3 3 5 5 2 1 4 10 5 7 2 6 1 3 1 6 4 7 5 3 1 3 2 9 5 4 10 8 3 10 4 4 8 5 4 6 10 4 10 9 6 7 4 6 7 7 6 2 6 6 10 10 6 8 8 9 4 6 3 3 9 8 1 8 5 8 2 7 3 1 10 5 10 1 5 8 5 6 6 7 9 7 3 5 8 4 4 3 2 9 3 10 2 5 4 2 2 6 3 3 5 8 4 2 1 2 9 2 3 6 3 8 9 4 10...

output:

8548 1 10
358083 1 10
371696 1 10
367527 1 10
31930 1 10
41965 1 5
4288 1 10
52736 1 9
311942 1 10
168381 1 10
136991 1 7
52274 1 9
35176 1 5
114387 1 10
4104 1 10
74578 1 6
188927 1 10
425739 1 10
46796 1 6
109184 1 6
47640 1 6
115544 1 6
123196 1 6
118225 1 6
160295 1 5
43007 1 10
10471 1 7
80111 ...

result:

ok 303618 numbers

Test #3:

score: 20
Accepted
time: 316ms
memory: 20116kb

input:

200000 200000
10 9 3 10 4 4 2 5 9 2 8 8 8 9 6 6 2 1 2 9 10 3 2 6 6 7 1 10 9 8 7 10 6 10 2 5 3 5 7 1 1 9 2 3 4 4 7 5 5 9 1 10 9 8 9 7 10 10 5 7 7 4 10 3 9 5 7 5 4 7 3 8 3 1 10 4 7 5 8 1 4 7 1 9 5 4 8 8 1 9 10 3 8 6 5 2 7 7 3 10 5 7 10 6 10 2 8 3 7 7 6 4 1 3 3 9 6 3 1 1 5 9 4 6 5 4 6 5 8 4 5 5 1 5 10 ...

output:

120436 1 10
27918 1 6
11888 1 10
48329 1 6
43608 1 6
151778 1 10
46169 1 6
46361 1 10
483850 1 10
124481 1 10
526839 1 10
119733 1 5
154279 1 10
7638 1 6
3630 1 5
54630 1 5
250280 1 10
123344 1 10
145094 1 6
130966 1 6
34776 1 10
26218 1 3
185021 1 9
28302 1 5
2697 1 10
135625 1 6
67958 1 4
164444 1...

result:

ok 303477 numbers

Test #4:

score: 20
Accepted
time: 317ms
memory: 20048kb

input:

199998 199995
10 4 6 4 4 4 3 5 2 9 5 2 10 9 8 6 7 5 1 6 5 3 7 10 8 5 6 9 2 5 3 8 6 9 5 2 7 2 10 6 1 7 6 3 4 3 9 5 2 4 8 9 1 8 7 4 6 1 10 3 8 7 2 7 1 1 8 3 1 3 2 2 2 3 5 10 5 7 6 10 10 1 8 1 9 7 7 10 3 7 8 6 10 7 6 3 3 10 1 4 2 2 7 9 5 3 1 6 10 10 3 2 10 3 1 6 4 1 3 6 7 2 10 9 8 1 5 1 1 8 6 3 4 3 4 9...

output:

1100462 1 10
1100462 1 10
681018 1 7
681018 1 7
340625 1 4
340629 1 4
340635 1 4
340636 1 4
280123 1 3
280128 1 3
280125 1 3
280127 1 3
280131 1 3
280127 1 3
280134 1 3
280131 1 3
240083 1 2
240082 1 2
240095 1 5
240085 1 2
240090 1 2
240085 1 2
240081 1 2
240085 1 2
240087 1 2
240082 1 2
240082 1 2...

result:

ok 303447 numbers

Subtask #3:

score: 20
Accepted

Test #5:

score: 20
Accepted
time: 420ms
memory: 18664kb

input:

200000 200000
615 736 846 534 658 429 631 720 898 583 797 295 303 336 449 358 57 338 954 414 330 212 171 200 403 553 308 20 805 249 767 291 545 196 324 928 439 197 20 601 737 748 817 858 816 130 403 858 813 936 771 242 833 863 978 260 357 856 954 89 673 733 364 473 903 445 823 894 49 747 382 56 309 ...

output:

4143168 1 1000
8707838 1 1000
47796901 1 1000
55161188 1 1000
17880698 1 1000
9738037 1 888
11217598 1 939
2273447 1 939
12642515 1 888
12437017 1 999
15429733 1 888
29802638 1 939
200711 2 887
51511251 1 1000
9402071 1 888
25821404 1 939
19529749 1 923
6444888 1 930
10956864 1 564
1514736 1 408
881...

result:

ok 303498 numbers

Test #6:

score: 20
Accepted
time: 409ms
memory: 20028kb

input:

200000 200000
125 824 862 182 678 103 976 229 994 666 261 737 199 82 516 546 993 137 824 978 152 110 658 490 260 884 466 658 80 203 193 443 19 931 960 23 631 599 241 535 772 487 972 459 325 180 450 245 625 743 373 110 795 745 877 694 50 259 939 542 544 831 881 600 77 748 527 805 36 348 118 781 452 9...

output:

50865154 1 1000
24220463 1 919
1989344 1 919
3666274 1 697
8844621 1 910
17319620 1 919
13277574 1 760
13369358 1 617
11322496 1 617
5979926 1 755
528498 1 351
3799125 1 351
9939407 1 351
12522427 1 1000
1849238 1 351
938420 1 339
16252281 1 1000
1216964 1 238
40887 1 342
1201726 1 712
3143310 1 351...

result:

ok 303603 numbers

Test #7:

score: 20
Accepted
time: 325ms
memory: 18984kb

input:

199997 199998
3 10 7 6 7 1 7 3 7 2 1 3 5 6 9 6 10 5 9 8 6 3 5 8 1 1 8 1 10 3 9 9 10 6 7 4 5 1 1 9 10 10 6 10 8 3 7 8 4 10 10 4 10 5 4 7 6 3 5 8 8 6 8 9 5 8 6 7 5 7 1 3 7 7 10 6 7 6 10 9 5 4 5 3 6 10 4 3 2 10 8 3 7 10 1 8 9 6 4 7 1 6 8 9 10 7 5 3 2 8 9 4 5 2 8 10 5 1 9 4 8 3 10 5 3 2 1 6 9 8 5 4 2 4 ...

output:

1103927 1 10
199995 1 2
199989 1 1
199995 1 2
199992 1 2
199997 1 2
199997 1 2
199988 1 1
199987 1 1
199992 1 1
199994 1 1
199987 1 1
199988 1 1
199989 1 1
199991 1 1
199994 1 1
199988 1 1
199992 1 1
199990 1 1
199992 1 1
199991 1 1
199998 1 3
199990 1 1
199991 1 1
199987 1 1
199998 1 3
199991 1 1
1...

result:

ok 303471 numbers

Subtask #4:

score: 20
Accepted

Test #8:

score: 20
Accepted
time: 538ms
memory: 18832kb

input:

200000 200000
78066 141247 11068 105207 26127 179253 104948 145839 150954 60877 67556 61673 69638 150806 127596 162902 125410 38242 97645 20582 193537 139906 114184 129867 126626 85640 91551 19445 134855 85251 22162 3798 122992 38278 131907 96159 153440 94561 185234 15296 76886 108452 70560 77355 14...

output:

9335629761 8 199997
291062233 15 145210
2757513812 2 114001
457932161 15 145210
2988949571 2 104377
2096022866 2 145091
51774664 57 104218
1802593096 2 101531
838652514 1 91888
2086037512 5 199981
1740038288 2 113977
2833816579 1 101510
1643368391 2 132714
1457965364 2 101524
868906251 2 101524
8249...

result:

ok 303507 numbers

Test #9:

score: 20
Accepted
time: 533ms
memory: 18848kb

input:

200000 200000
58317 79021 111303 154733 179567 182629 28968 33314 26824 125092 137496 124768 21399 111741 66359 31703 141726 116799 156902 28665 149214 66685 131783 19127 38615 4167 165498 40897 131724 96109 70688 194505 116284 197762 197275 125439 199849 166102 198410 81173 189204 163194 89937 6629...

output:

10985120427 2 200000
14253061393 1 200000
14076919529 1 200000
155392718 18 199663
3863170615 1 199996
434379913 1 195113
4794602467 1 130342
546767600 22 130346
1870193310 1 199971
179334704 16 195113
8677927116 1 130348
106148166 2 130332
960648401 1 117463
2257713113 1 130348
7347437398 1 199939
...

result:

ok 303558 numbers

Test #10:

score: 20
Accepted
time: 418ms
memory: 20028kb

input:

200000 200000
100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 ...

output:

9999999999 1 100000
9999999999 1 100000
9999600003 1 99996
9998600013 1 99986
9998600013 1 99986
9998600013 1 99986
9998600013 1 99986
9998600013 1 99986
9998600013 1 99986
9998600013 1 99986
9998400015 1 99984
9998200017 1 99982
9997800021 1 99978
9997400025 1 99974
9997000029 1 99970
9997000029 1 ...

result:

ok 300624 numbers

Test #11:

score: 20
Accepted
time: 344ms
memory: 20940kb

input:

200000 200000
100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000...

output:

19999800000 100000 100000
19999800000 100000 100000
19999800000 100000 100000
19999800000 100000 100000
19999800000 100000 100000
19999800000 100000 100000
19999800000 100000 100000
19999800000 100000 100000
19999800000 100000 100000
19999800000 100000 100000
19999800000 100000 100000
19999800000 10...

result:

ok 300624 numbers

Subtask #5:

score: 20
Accepted

Test #12:

score: 20
Accepted
time: 2228ms
memory: 19652kb

input:

500000 500000
56 22353719 15918 54 13 1 389 7 809 2204 75911688 4218278 36 7205 93542078 506 4761175 102646343 48 65900 10 228 2 292994 26348644 6 19339 148 704 232124395 19307 52070 8964343 7430314 42755 115 869 32485365 252183868 481162087 852632 38758 2945883 279412 15012 82 33076951 1537 6954898...

output:

106593480756 1 984003850
3657321749885 1 772605710
4340368607039 1 997617313
2024546424119 1 999735807
1053708059297 1 999735807
1594458070417 1 999904830
3990648241119 1 772605710
2714488265571 1 999735807
384978298678 1 772605710
1159542455950 1 999273673
3500807088693 1 967123827
5113110257086 1 ...

result:

ok 741759 numbers

Test #13:

score: 20
Accepted
time: 5206ms
memory: 19628kb

input:

500000 500000
719948 153 112344106 7040 61985682 1 4356 19222 34672195 143174 78 125 40 3164569 5392 441953981 421249543 12617 3266128 328415 53035 94 9 1346009 225 15 59366 45339 5849 2398 27 156152 2638 4843 26647250 11247481 329 214049 894418 3236 208 1 484 238 8994209 369935 86558 40 221409788 1...

output:

5285629884440 1 999595241
1354254428547 1 998815652
6209523108119 1 999667867
2643824165208 1 999237892
325473150578 1 998669925
1404935498427 1 999492008
4164725213474 1 999492008
10565537848386 1 999667866
5605651848441 1 999667866
596109764947 1 999382953
8182967158272 1 999667866
23983679113 1 9...

result:

ok 749955 numbers

Test #14:

score: 20
Accepted
time: 1175ms
memory: 19696kb

input:

500000 500000
1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 ...

output:

8026000008025 1 1000000000
27600989649626 1 999999624
8238996338525 1 999999624
81362960647319 1 999999687
6026997731789 1 1000000000
78299915801111 1 999999132
12387975001016 1 999997981
32302970208351 1 1000000000
40351942833256 1 999999132
128012549695034 1 1000000000
40700911063983 1 999998877
5...

result:

ok 758784 numbers

Test #15:

score: 20
Accepted
time: 2501ms
memory: 19988kb

input:

500000 500000
1073407 283193 20385 5011866 2 115524490 2697 9 16 129664216 8848 105017 2875465 265260 9094846 2 14 31117 3 252 240087622 259 282 26043524 2821157 1840 15 886794143 335431476 2 102453 118282 368335348 1015112 47696 3744460 101333101 856 41641 18669 246439 204 106974535 1091958 683 511...

output:

4742168057689 1 691487645

result:

ok 3 number(s): "4742168057689 1 691487645"

Test #16:

score: 20
Accepted
time: 2165ms
memory: 20968kb

input:

499993 499947
13414 23 32141 104807103 1174 495217 44780963 1300464 19 6203 971535498 782408085 49963750 381 230040650 54452 410395414 51005 43 878213 503990390 42198918 14766 925276 1357043 1444680 390091 492648 168613 27 858072 429791 80038 53142 111502 129082975 1 47442077 359562738 13824753 1532...

output:

2453076569360 1 999240106
14472971286976 1 999984216
1219095316005 1 999513073
3487338535438 1 999982855
8411392124584 1 999620485
6744171119065 1 999813722
3353888410654 1 999712807
3361207525003 1 999620485
12416955594065 1 999813722
11469791076989 1 999813722
7401080028481 1 999812483
24726061606...

result:

ok 742260 numbers

Test #17:

score: 20
Accepted
time: 1822ms
memory: 20304kb

input:

500000 500000
1581 895 46203 49 129606351 2 31495192 213963419 1291 4536 362 4058 15414 1440 184847279 237 277321048 905050338 952286 369044346 8068 53 747186357 34 2960 132 388315 13 231 1 51242 141068292 40073573 155291367 162969 39548 461826822 419 106617135 1 83667 1931884 20276468 16 209363 417...

output:

17498248305875 1 999969822
17498248305875 1 999969822
17498248305875 1 999969822
17498248305875 1 999969822
17498248305875 1 999969822
17498248305875 1 999969822
17498248305875 1 999969822
17498248305875 1 999969822
17498248305875 1 999969822
17498248305875 1 999969822
17498248305875 1 999969822
174...

result:

ok 1499997 numbers

Test #18:

score: 20
Accepted
time: 2147ms
memory: 19784kb

input:

499926 499930
22937262 1613 906389 566 932238802 13950 14189125 3047588 15 423235434 7313 56975057 7087213 10 35661699 6598 244 196464021 408789794 9 10474413 1251 1019428 17350047 5 851592 2462 2 2166042 36762719 5360640 14857807 10447890 155682563 12461137 6429 25101566 869501 80281 59015909 20 33...

output:

1758069221739 1 999476727
8175967307588 1 999862940
6132878512178 1 999951781
4521065687476 1 999862940
159378017701 1 992737998
8648463605465 1 999862940
288142899618 1 996062426
2717594258415 1 999135330
10228430093991 1 999862699
268775935507 1 999038080
6546651272480 1 999862699
2165382278738 1 ...

result:

ok 741552 numbers

Test #19:

score: 20
Accepted
time: 1723ms
memory: 20520kb

input:

499975 499948
4268 4 3628 29677261 54 198 15028150 3834289 11468351 609241 65358445 1749982 26241 1441 133510652 1477700 9359775 7 136042 235 33450656 43383666 1179100 10380 923456394 5 106270 204908 1 878777 1 4675 21629 37046 2597 243 8678080 4588828 1550 28277393 406287122 19 36 123 1860 19556841...

output:

17367588833012 1 999917498
17367652224951 1 999917498
11637809535582 1 684383667
11569383346014 1 684007335
11543614547228 1 683877294
11543614547228 1 683877294
7119081091781 1 460391025
7119081091781 1 460391025
7119087875366 1 460390918
5064287109678 1 417008753
5064286179722 1 417008751
50643336...

result:

ok 742071 numbers

Test #20:

score: 20
Accepted
time: 1776ms
memory: 20344kb

input:

499933 499965
72617 216291885 45223 29 1517450 155867 10785010 6 1 47638 106 1232724 4005 4 4040433 334 130000 11 48132 805044 12 1677547 26009001 5234576 1679070 5 127890154 13289 1272784 1440 20049103 808392 2665 6788 108359263 98826036 1 24738 95797 2727601 811799944 447729824 1 101488 53176 5474...

output:

17271893460704 1 999960431
14412166335901 1 963587687
14412509235472 1 963587687
9879482788366 1 487060977
9879139888906 1 487060977
9879482788366 1 487060977
8798446378594 1 466760205
8798446327112 1 466760205
8798446327112 1 466760205
8798103427652 1 466760205
8404573062274 1 461173170
84049159547...

result:

ok 740415 numbers

Test #21:

score: 20
Accepted
time: 900ms
memory: 19824kb

input:

500000 500000
694829454 483733551 292460415 823782593 744624297 420561207 399213478 337739884 966310522 302471278 183626881 581269571 466684416 722213719 236851903 122262701 673832771 705845795 574424551 718654321 772976205 631315433 307437345 586483008 479499589 932783947 821055825 812342412 546414...

output:

266584300996313 100003034 999999925
266570575819349 100003034 999999925
266576352144850 100003034 999999925
266593471832108 100003034 999999925
266595934324779 100003034 999999925
266580628726340 100003034 999999925
266578623948237 100003034 999999925
266607429907225 100003034 999999925
266590994304...

result:

ok 750000 numbers

Test #22:

score: 20
Accepted
time: 1304ms
memory: 20236kb

input:

499965 499960
753595026 746922541 928926464 772122918 826680095 830796765 987135861 945779707 905440724 815594326 873548346 777549959 992851668 713760013 706212336 763291625 923131022 868302524 832005252 977289791 965060653 971529129 947481825 850890330 849555389 885017337 747189086 904825982 909506...

output:

394228444675352 638476595 992851668
366233708362000 582542614 956120387
366234853510603 582542614 928365051
329827594098851 509796316 904332053
329865012335034 509796316 954215507
308846250513802 467764208 974937883
280629477444705 411334912 788535458
280663806581097 411334912 956134436
280638400093...

result:

ok 749838 numbers

Test #23:

score: 20
Accepted
time: 1379ms
memory: 19884kb

input:

499999 499982
1000000000 1 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1 1000000000 1000000000 1 1000000000 1 1000000000 1000000000 100000...

output:

1699044 1 4
1698929 1 4
6891048 1 2801891
9891354572 1 865714391
3322317813 1 518232365
1698995 1 4
549554491 1 142433925
1698932 1 4
1698793 1 4
1698983 1 4
1698977 1 4
2848354658 1 450073828
6567898566 1 826816568
577561997 1 142433925
1699031 1 4
2369766 1 670733
1698983 1 4
2354011653 1 41428579...

result:

ok 757170 numbers

Test #24:

score: 20
Accepted
time: 1381ms
memory: 19716kb

input:

499989 499995
1000000000 1 1000000000 1000000000 1 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1000000000 1000000000 1000000000 1 1000000000 1000000000 1 1 1000000000 1000000000 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000...

output:

1700120 1 4
1700192 1 4
1700049 1 4
1700126 1 4
1699904 1 4
1700155 1 4
32099639 1 30399596
1700051 1 4
32099918 1 30399596
1700193 1 4
1700076 1 4
1700056 1 4
1394509186 1 779944694
1700089 1 4
1700012 1 4
614564424 1 493613506
1700014 1 4
1700088 1 4
1699858 1 4
1700255 1 4
62088472 1 55397226
170...

result:

ok 757287 numbers

Test #25:

score: 20
Accepted
time: 1624ms
memory: 19828kb

input:

499922 499935
11675 72387 21650698 2901106 114 1653620 270730582 10729 3357301 3018547 3792337 24180210 6571 500743 1022100 516125 121 22 215 76497 15 809135 15299 1 35667 1080 1 5 13 1628952 1009080 3283 4544900 87 41868005 347520 2814 50 98 11670217 532 152661093 3 29543585 2055103 2916 2990 65033...

output:

17322119593834 1 999855468
17321650855018 1 999855468
17312363726122 1 999808653
17304914441385 1 999779778
17301671365378 1 999766942
17299351385570 1 999755404
17301282540205 1 999755404
17294894309924 1 999728414
17292979800708 1 999715867
17288740255962 1 999695597
17286512913411 1 999688896
172...

result:

ok 250065 numbers

Test #26:

score: 20
Accepted
time: 3169ms
memory: 20652kb

input:

499917 499915
98 1586 481215404 6 105 51 6537144 125 3539068 90675300 30610646 20710120 6 171916 13 15 29299308 3 2552 134104 33 3245 15089 248122271 153 566 3007 13812 901 54681 11 43816 2681266 96 862364 4 198382377 531 186 184366158 241 4005688 12694702 94801 23058 89 15 27474 25493 4221 1 433552...

output:

17517951186196 1 999983516
17517707991836 1 999983506
17515327301142 1 999983479
17518208815496 1 999983468
17515349361782 1 999983431
17518080783983 1 999983428
17514782432552 1 999983417
17516656998482 1 999983417
17518214069708 1 999983410
17516476245696 1 999983407
17518160085624 1 999983407
175...

result:

ok 249138 numbers

Test #27:

score: 20
Accepted
time: 1044ms
memory: 20024kb

input:

499952 499959
7006855 3041783 6545 11 14 11064 1176093 2 289 41 187 77758957 1 5098705 2 20 17 824 3658 8189 90621 25958 449254219 2866 127452566 4 1209726 59 228 361785 106 29982 59376 184557 7 5 9921 1161 1673614 152 74591 3 23254 98877 103891 7417750 9591 14 11812 127767 33389434 642 30348890 6 2...

output:

17579995409329 1 999840884
17532308246463 1 999601653
17510720784534 1 999489346
17501960034744 1 999440240
17423575859400 1 998962949
17409222194961 1 998870739
17392330684377 1 998762319
17378341577629 1 998679061
17369889728081 1 998614790
17358817808097 1 998546739
17244109328274 1 997735656
172...

result:

ok 250509 numbers

Test #28:

score: 20
Accepted
time: 5062ms
memory: 20924kb

input:

499993 499999
337548078 980115635 438962109 411593462 80727047 498144984 609888262 29553154 480019862 147261550 784169416 151311353 939136017 70255953 875334221 958075309 285964471 320728426 604624709 170734256 766787458 35954437 345142709 641449275 29100373 974061320 756593437 275985291 403515924 5...

output:

17382132998732 9681 999977904
39457315310497 1961 999995423
67513445825226 1961 999995342
13201970795989 20156 999991588
73999818587733 16172 999995288
14049153549642 9681 999977904
70489392952044 6527 999993570
112925001604411 165 999993570
62085016428019 11999 999995849
16512623725195 60409 999991...

result:

ok 748548 numbers

Test #29:

score: 20
Accepted
time: 5214ms
memory: 19692kb

input:

500000 500000
719948 153 112344106 7040 61985682 1 4356 19222 34672195 143174 78 125 40 3164569 5392 441953981 421249543 12617 3266128 328415 53035 94 9 1346009 225 15 59366 45339 5849 2398 27 156152 2638 4843 26647250 11247481 329 214049 894418 3236 208 1 484 238 8994209 369935 86558 40 221409788 1...

output:

5285629884440 1 999595241
1354254428547 1 998815652
6209523108119 1 999667867
2643824165208 1 999237892
325473150578 1 998669925
1404935498427 1 999492008
4164725213474 1 999492008
10565537848386 1 999667866
5605651848441 1 999667866
596109764947 1 999382953
8182967158272 1 999667866
23983679113 1 9...

result:

ok 749955 numbers

Test #30:

score: 20
Accepted
time: 5001ms
memory: 19716kb

input:

500000 500000
849538594 310805964 462493306 893228688 966049066 522150189 354454446 853542942 53477169 186382579 708296326 189472899 967892574 873458249 64670131 553867999 437389717 641575465 156903712 234646513 505030432 845232547 510187158 744981290 554993517 464825097 904581842 775538983 12443207...

output:

118435874758405 580 999998655
36548066510627 138 999997706
237167934085663 138 999998655
209380292403150 138 999998644
7173420259353 49574 999863051
49241898694492 138 999995032
52350326647318 308 999998383
230246569350790 71 999998383
167594441152846 71 999998383
151494875300853 71 999998383
164767...

result:

ok 749394 numbers

Test #31:

score: 20
Accepted
time: 4039ms
memory: 20304kb

input:

499993 499991
110383508 162658616 549003839 939259653 279510792 513961344 245383397 141135943 565641181 207678546 976369561 790533279 602000217 769157735 40084135 139604781 691664949 487960788 56476499 798718751 185294457 489275712 352539855 133606967 709201247 30498811 807974368 267791555 833481456...

output:

72313484529190 6826 999999038
14628766284717 16767 999912620
166488079281655 6826 999999038
26974898472302 7576 999997289
98472806439666 6755 999998931
110273992362158 2079 999998931
128058305148186 6755 999998931
152519366665472 1818 999986361
136810390757515 1818 999992181
142624395651023 1812 999...

result:

ok 750057 numbers

Test #32:

score: 20
Accepted
time: 4100ms
memory: 19712kb

input:

500000 499993
978639056 31272854 526004240 734065629 102254252 845846792 394297093 408385401 571333748 955552941 510204305 607967172 326604732 553119030 990002905 612378570 67942465 653077276 103734088 388042954 647142961 833320196 349067339 713949191 690494053 82953899 117086251 385343414 702961623...

output:

177205855269214 420 999995278
91422471582004 1835 999995278
56963992777097 14375 999995278
159119245461768 416 999995278
74614596429359 1835 999995278
63956168227786 2082 999988012
43024020754090 416 999967645
94079630516253 416 999986543
49271695666927 342 995027990
131887514068236 340 999989652
99...

result:

ok 751335 numbers

Test #33:

score: 20
Accepted
time: 5404ms
memory: 20584kb

input:

499995 499993
317371238 222196158 152838847 883770616 388835510 817582250 946920451 593742851 325403427 236461741 308761085 425687585 370002279 791174450 880139445 110495406 720616715 832252526 599369558 22642230 814200485 114902213 269887550 785302421 548988621 211677179 930915779 756761686 5809316...

output:

92327950555257 1415 999996753
128297709682166 1405 999996753
112555185540789 1364 999996712
57329995142190 2724 999990150
204823139574641 1364 999996712
125789646766503 1364 999996712
166526515629045 1364 999996712
33173499480285 3044 999989284
98523496243400 2678 999994600
106321651383762 1331 9999...

result:

ok 751137 numbers

Test #34:

score: 20
Accepted
time: 4119ms
memory: 20604kb

input:

499991 499991
644400019 625620577 671207629 790789087 240101465 592585545 830302963 561706752 214416654 463956127 921668989 271361266 331161305 540060187 224147744 293605329 400880491 980914658 715459365 362496869 600333971 909524997 192328373 215869032 589105008 277712512 940390198 93582842 7133281...

output:

223783494281251 887 999999687
234441150518210 853 999997810
98602515645014 887 999997810
112442105231353 750 999974416
233695449594095 357 999974837
153038488947974 357 999974416
188925092392124 310 999974369
243955127902901 300 999974783
139377911733205 639 999773724
153988494261934 231 999974714
2...

result:

ok 751158 numbers

Test #35:

score: 20
Accepted
time: 4239ms
memory: 19680kb

input:

499995 500000
877039784 140076889 396982677 610571671 371535122 734285588 619316174 231906722 122014843 550202484 908552866 550976078 580299599 400003815 8378490 23950786 824195095 264429653 186843328 738792645 121132026 311864222 26231502 327725640 636964153 278010883 707049685 150323943 345439141 ...

output:

188250065892483 636 999991093
205246207157955 636 999991093
53694232382744 1831 999988591
153033973263652 636 999984202
199183449487993 636 999991093
79014506528290 2225 999984157
145334231637708 591 999984157
229907391861783 591 999991079
47513362926613 558 999982234
86209169660197 558 999984124
11...

result:

ok 749349 numbers

Test #36:

score: 20
Accepted
time: 4899ms
memory: 19768kb

input:

499992 499997
199666399 788963763 814598296 883310037 536995307 314151470 41006244 681206571 373891309 45627216 931529132 879852134 572344923 560020264 871594235 874674074 362758837 235805049 682582742 101490501 524188723 155044788 592043136 228265699 168962744 355310324 694432560 977920212 14937966...

output:

136747262355159 685 999998494
116636692033859 1234 999948857
129360309136945 621 999998430
170571917513870 621 999998430
112797935953969 621 999998430
151325738485843 1234 999948857
211811423584334 621 999998430
235381939253282 420 999998280
238890645402533 420 999998280
214928299187283 420 99999828...

result:

ok 749889 numbers

Test #37:

score: 20
Accepted
time: 3571ms
memory: 20024kb

input:

499995 500000
391559056 833930203 889406877 911163192 744128516 383647043 466391247 342600900 442231299 943753955 442000376 734511028 187179960 532699567 73434574 942493931 368947794 478975418 620087241 762921419 396802493 871946418 488892646 553580169 406196072 235778175 413803138 841337924 3350503...

output:

216418056798028 1366 999999436
228221950675907 146 999929186
234361171906758 3 999908741
249412849371373 3 999908741
230485251162705 1 999901013
168141497624697 1 999808129
238924560564419 1 999900054
242530862865210 1 999797819
210485571150832 1 999797819
233009205078836 1 999897958
230974621890390...

result:

ok 240072 numbers

Test #38:

score: 20
Accepted
time: 4892ms
memory: 20632kb

input:

500000 500000
951163091 253531318 989372521 256502882 55765718 118527975 600906887 418705665 739063229 969706244 790001261 420064794 703972157 399838609 21927133 706139412 262590677 559806795 769184154 781388758 446005695 304082931 973019192 302601866 222195827 34960966 639997514 596067571 203224836...

output:

230496896426976 1609 999997119
249121356453523 1609 999999570
240092558961716 1609 999999570
240029286253823 1604 999999565
244103001109142 1604 999999565
241108449437097 1585 999999546
246641550518692 1577 999999538
249143521509133 1577 999999538
246606161547999 1577 999999538
232410757912424 1577 ...

result:

ok 810390 numbers

Test #39:

score: 20
Accepted
time: 4442ms
memory: 19700kb

input:

499996 499999
729763214 809336549 571478661 389298661 18147023 797458379 727536693 677330110 821111894 352637902 820033928 702324399 62213139 243900065 169305673 108458919 427769819 67617987 623198739 406319926 145580789 142426585 596484542 799851917 773159867 931968991 155240706 908409193 857290219...

output:

204615056494570 1615 999998818
247238615066879 1615 999998818
215495277039911 1615 999998818
223014882217207 1465 999996378
212370994623304 1465 999993742
170217703194115 1465 999993742
234930353695704 1465 999996378
174779065352164 315 999992615
233065338222621 310 999979329
231173235030363 200 999...

result:

ok 600396 numbers

Test #40:

score: 20
Accepted
time: 4712ms
memory: 19724kb

input:

500000 500000
282868067 799781380 505588704 706506801 114606481 218552232 183592709 280244043 901101749 25924542 474869764 579229655 227679395 958348254 929439503 782314913 460515337 50087374 117900600 282766438 824882300 539770900 373511609 426898645 875846238 140959067 556462329 949305135 64323522...

output:

181784132133040 1908 999998598
186252913193889 1908 999998598
246244525567715 1206 999998888
231029725088902 1206 999998888
248232286873334 1183 999998865
241020734221596 735 999996622
229333589391061 726 999996611
238045739832413 546 999988685
221408754599994 983 999988680
238483050741687 546 99998...

result:

ok 630204 numbers

Test #41:

score: 20
Accepted
time: 4049ms
memory: 20032kb

input:

500000 500000
244735333 424995835 938536406 58394934 821968500 542479034 174515349 248581961 144408286 842033025 524828124 206388762 57008136 279047827 298436780 671461224 523272901 53146342 14981243 752801809 865642519 381585862 948123986 847964286 766922642 813631826 862385497 115051135 906013660 ...

output:

243900106015411 391 999999100
212092898141835 371 999999080
139154193552580 282 999998370
242670737966761 75 999997081
245510678138761 75 999997081
236623539099390 3 999979929
227595488204046 1 999978377
188613375919872 2 999978219
232860748595006 1 999977991
212819650308198 1 999977706
238014759695...

result:

ok 165510 numbers

Test #42:

score: 20
Accepted
time: 4394ms
memory: 19984kb

input:

500000 500000
937199377 532349101 334230843 832382321 182067022 776916465 621423030 866923441 89273261 517661964 686774637 731579933 943882702 568588569 358006877 325066444 91224850 509893636 211340492 620151051 161440715 943373133 71658213 997354186 357995889 124288697 898112868 455328483 334968381...

output:

243209723820791 79 999994703
244988317542855 79 999994703
249239936605811 79 999994703
237695163536364 79 999994703
248389651387492 79 999991960
223998370173804 65 999991946
217372847445815 53 999991934
249733089544734 12 999991192
243915834019858 2 999991182
237710363182362 2 999986677
239439695585...

result:

ok 869436 numbers

Test #43:

score: 20
Accepted
time: 4002ms
memory: 20436kb

input:

500000 500000
152001707 976262238 146412283 651906098 682863311 51589028 321237213 464504523 360227659 333321805 334419081 340861004 366699644 145337633 249777989 68016951 444735793 639452416 63677819 583928712 874192406 313893050 941387635 435569561 281760133 731331367 463304168 2753892 614429561 1...

output:

225697134788263 2986 999999322
248306610537833 2768 999999104
236478727111626 2768 999999104
210021862851710 2768 999999104
249153185271879 2768 999999104
232842578236447 2676 999999012
222055998054871 2671 999999007
235971075928618 2667 999999003
208452691345745 2660 999998996
226322476087129 2660 ...

result:

ok 719730 numbers

Test #44:

score: 20
Accepted
time: 1268ms
memory: 19688kb

input:

500000 500000
79799177 4352 2 51378 7 41801 7343 4131 7449811 34 1766 2664 711784 726 25319449 1836427 3 42 15 13511572 6806 9704 913 54409 4392768 24 486 20 30978 37758656 1087830 92 35 10 233 26129738 3 2461 424 69 290 254122978 472730 85 1 24988864 7 185054082 575 6719 1405909 5876788 7 10996 351...

output:

17404256636930 1 999967518
17404244202530 1 999967488
17404244202530 1 999967488
17404244202530 1 999967488
17404244202530 1 999967488
17404204882314 1 999967384
17404204882314 1 999967384
17404204882314 1 999967384
17404204882314 1 999967384
17404204882314 1 999967384
17404204882314 1 999967384
174...

result:

ok 740781 numbers