QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#623823#7449. rgxsxrsN_z_100 ✓4879ms31580kbC++2011.5kb2024-10-09 14:06:472024-10-09 14:06:49

Judging History

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

  • [2024-10-09 14:06:49]
  • 评测
  • 测评结果:100
  • 用时:4879ms
  • 内存:31580kb
  • [2024-10-09 14:06:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
struct time_helper{
#ifdef LOCAL
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();}
#else
void test(){}
#endif
}time_helper;
#ifdef LOCAL
#include"dbg.h"
#else
#define dbg(...) (__VA_ARGS__)
#endif
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 getchar Fread::getchar
#define putchar Fwrite::putchar
int print_precision=10;bool print_T_endl=1;char print_between=' ';
template<typename T>struct is_char{static constexpr bool value=(std::is_same<T,char>::value||std::is_same<T,signed char>::value||std::is_same<T,unsigned char>::value);};template<typename T>struct is_integral_ex{static constexpr bool value=(std::is_integral<T>::value||std::is_same<T,__int128>::value)&&!is_char<T>::value;};template<typename T>struct is_floating_point_ex{static constexpr bool value=std::is_floating_point<T>::value||std::is_same<T,__float128>::value;};namespace Fastio{struct Reader;struct Writer;template<size_t id>struct read_tuple{template<typename...T>static void read(Reader&stream,std::tuple<T...>&x){read_tuple<id-1>::read(stream,x);stream>>get<id-1>(x);}};template<>struct read_tuple<0>{template<typename...T>static void read([[maybe_unused]]Reader&stream,[[maybe_unused]]std::tuple<T...>&x){}};template<size_t id>struct print_tuple{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){print_tuple<id-1>::print(stream,x);putchar(print_between);stream<<get<id-1>(x);}};template<>struct print_tuple<1>{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){stream<<get<0>(x);}};template<>struct print_tuple<0>{template<typename...T>static void print([[maybe_unused]]Writer&stream,[[maybe_unused]]const std::tuple<T...>&x){}};
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';
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 cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
template<class Fun>class y_combinator_result{Fun fun_;public:template<class T>explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}template<class ...Args>decltype(auto) operator()(Args &&...args){return fun_(std::ref(*this), std::forward<Args>(args)...);}};template<class Fun>decltype(auto) y_combinator(Fun &&fun){return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));}

void init();void solve(int tc);
main()
{
    init();int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)solve(tc);
}
void init()
{
}
constexpr int vlim=100000,inf=1e9;
int a[500001],n;
struct node
{
    int mi,mx,cnt,tag;
    long long sum;
    // node()=delete;
    node operator+(const node&b)
    {
        return {min(mi,b.mi),max(mx,b.mx),cnt+b.cnt,0,sum+b.sum};
    }
}tr[11][vlim+2];
void bbuild(int u,int l,int r)
{
    for(int x=0;x<=10;x++)
    tr[x][u]=node{inf,0,0,0,0};
	for(int x=l;x<=r;x++)
	tr[__lg(a[x])/3][u]=tr[__lg(a[x])/3][u]+node{a[x],a[x],1,0,a[x]};
}
void build(int u,int l,int r)
{
	if(u*2>vlim)
	{
		bbuild(u,l,r);
		return;
	}
    if(l==r)
    {
        for(int x=0;x<=10;x++)
        tr[x][u]=node{inf,0,0,0,0};
        tr[__lg(a[l])/3][u]={a[l],a[l],1,0,a[l]};
        return;
    }
    int mi=(l+r)/2;
    build(u*2,l,mi);
    build(u*2+1,mi+1,r);
    for(int x=0;x<=10;x++)
    tr[x][u]=tr[x][u*2]+tr[x][u*2+1];
}
void addtag(int u,int lv,int val)
{
    tr[lv][u].mx-=val;
    tr[lv][u].mi-=val;
    tr[lv][u].tag+=val;
    tr[lv][u].sum-=1ll*tr[lv][u].cnt*val;
}
void pushdown(int u,int lv)
{
    if(tr[lv][u].tag)
    {
        addtag(u*2,lv,tr[lv][u].tag);
        addtag(u*2+1,lv,tr[lv][u].tag);
        tr[lv][u].tag=0;
    }
}
void bapplytag(int u,int l,int r)
{
	for(int x=l;x<=r;x++)
	a[x]-=tr[__lg(a[x])/3][u].tag;
    for(int x=0;x<=10;x++)
	tr[x][u].tag=0;
}
void bapplytag(int u,int l,int r,int lv)
{
	if(tr[lv][u].tag)bapplytag(u,l,r);
}
void bupdate0(int u,int l,int r,int pos,int val,int lv)
{
	bapplytag(u,l,r,lv);
	a[pos]=val;
	tr[lv][u]=node{inf,0,0,0,0};
	for(int x=l;x<=r;x++)
    {
        if(x==pos)a[x]=val;
	    if(__lg(a[x])/3==lv)tr[lv][u]=tr[lv][u]+node{a[x],a[x],1,0,a[x]};
    }
}
void update0(int u,int l,int r,int pos,int val,int lv)
{
	if(u*2>vlim)
	{
		bupdate0(u,l,r,pos,val,lv);
		return;
	}
	if(l==r)
	{
		tr[lv][u]={val,val,1,0,val};
		return;
	}
	pushdown(u,lv);
	int mi=(l+r)/2;
	if(pos<=mi)update0(u*2,l,mi,pos,val,lv);
	else update0(u*2+1,mi+1,r,pos,val,lv);
	tr[lv][u]=tr[lv][u*2]+tr[lv][u*2+1];
}
void bmodify(int u,int l,int r,int L,int R,int val,int lv)
{
    bapplytag(u,l,r,lv);
    for(int x=l;x<=r;x++)
    if(L<=x&&x<=R&&__lg(a[x])/3==lv&&a[x]>val)
    {
        if(a[x]-val>=(1<<(lv*3)))a[x]-=val;
        else
        {
            int k=a[x]-val;
            int nlv=__lg(k)/3;
            update0(1,1,n,x,k,nlv);
        }
    }
    tr[lv][u]=node{inf,0,0,0,0};
    for(int x=l;x<=r;x++)
    if(__lg(a[x])/3==lv)tr[lv][u]=tr[lv][u]+node{a[x],a[x],1,0,a[x]};
}
void modify(int u,int l,int r,int L,int R,int val,int lv)
{
    // cerr<<u<<','<<l<<','<<r<<','<<L<<','<<R<<','<<lv<<endl;
    if(tr[lv][u].mx<=val)return;
	if(u*2>vlim)
	{
		bmodify(u,l,r,L,R,val,lv);
		return;
	}
    if(L<=l&&r<=R&&tr[lv][u].mi-val>=(1<<(lv*3)))
    {
		// cerr<<"addtag"<<u<<','<<lv<<','<<val<<endl;
		addtag(u,lv,val);
        return;
    }
    if(l==r)
    {
		int k=tr[lv][u].mx-val;
        int nlv=__lg(k)/3;
		// cerr<<"specialadd"<<u<<','<<lv<<','<<nlv<<','<<val<<','<<k<<endl;
        tr[lv][u]=node{inf,0,0,0,0};
        update0(1,1,n,l,k,nlv);
        return;
    }
    pushdown(u,lv);
    int mi=(l+r)/2;
    if(L<=mi)modify(u*2,l,mi,L,R,val,lv);
    if(mi<R)modify(u*2+1,mi+1,r,L,R,val,lv);
    tr[lv][u]=tr[lv][u*2]+tr[lv][u*2+1];
}
node bquery(int u,int l,int r,int L,int R)
{
    bapplytag(u,l,r);
    node res=node{inf,0,0,0,0};
    for(int x=l;x<=r;x++)
    if(L<=x&&x<=R)res=res+node{a[x],a[x],1,0,a[x]};
    return res;
}
node query(int u,int l,int r,int L,int R)
{
	if(u*2>vlim)
	{
		return bquery(u,l,r,L,R);
	}
    if(L<=l&&r<=R)
    {
        node res=node{inf,0,0,0,0};
        for(int x=0;x<=10;x++)
        res=res+tr[x][u];
        return res;
    }
    for(int x=0;x<=10;x++)
    pushdown(u,x);
    int mi=(l+r)/2;
    if(R<=mi)return query(u*2,l,mi,L,R);
    if(mi<L)return query(u*2+1,mi+1,r,L,R);
    return query(u*2,l,mi,L,R)+query(u*2+1,mi+1,r,L,R);
}
void boutput(int u,int l,int r)
{
    cerr<<"detail in "<<l<<','<<r<<endl;
    bapplytag(u,l,r);
    for(int x=l;x<=r;x++)
    cerr<<a[x]<<' ';cerr<<endl;
}
void output(int u,int l,int r)
{
    node res=node{inf,0,0,0,0};
    for(int x=0;x<=10;x++)
    res=res+tr[x][u];
    cerr<<u<<','<<l<<','<<r<<','<<res.sum<<','<<res.mi<<','<<res.mx<<','<<res.cnt<<endl;
	if(u*2>vlim)
	{
		boutput(u,l,r);
        return;
	}
	// for(auto i:{0,1})
	// cerr<<i<<':'<<tr[i][u].sum<<','<<tr[i][u].mi<<','<<tr[i][u].mx<<','<<tr[i][u].cnt<<endl;
    if(l==r)return;
    for(int x=0;x<=10;x++)
    pushdown(u,x);
    int mi=(l+r)/2;
    output(u*2,l,mi);
    output(u*2+1,mi+1,r);
}
void solve([[maybe_unused]]int tc)
{
    int m;
    cin>>n>>m;
    for(int x=1;x<=n;x++)
    cin>>a[x];
    build(1,1,n);
    int lastans=0;
    while(m--)
    {
        // cerr<<"-----------"<<endl;output(1,1,n);cerr<<"----------"<<endl;
        int op;
        cin>>op;
		// lastans=0;
        if(op==1)
        {
            int l,r,x;
            cin>>l>>r>>x;
            l^=lastans,r^=lastans,x^=lastans;
            for(int i=0;i<=10;i++)
            modify(1,1,n,l,r,x,i);
        }
        else
        {
            int l,r;
            cin>>l>>r;
            l^=lastans,r^=lastans;
            node res=query(1,1,n,l,r);
            cout<<res.sum<<' '<<res.mi<<' '<<res.mx<<endl;
            // cerr<<res.sum<<','<<res.mi<<','<<res.mx<<endl;
            lastans=res.sum%(1<<20);
        }
    }
}

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 2ms
memory: 26272kb

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: 154ms
memory: 30272kb

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: 157ms
memory: 30384kb

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: 116ms
memory: 30472kb

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: 274ms
memory: 30272kb

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: 262ms
memory: 31504kb

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: 110ms
memory: 30412kb

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: 372ms
memory: 30356kb

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: 371ms
memory: 30672kb

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: 220ms
memory: 30264kb

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: 99ms
memory: 30580kb

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: 1531ms
memory: 31508kb

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: 3395ms
memory: 31504kb

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: 663ms
memory: 31496kb

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: 2831ms
memory: 31520kb

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: 1524ms
memory: 31440kb

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: 473ms
memory: 31580kb

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: 1504ms
memory: 31444kb

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: 1273ms
memory: 31504kb

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: 1294ms
memory: 31552kb

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: 239ms
memory: 31508kb

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: 475ms
memory: 31556kb

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: 769ms
memory: 31500kb

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: 821ms
memory: 31428kb

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: 1684ms
memory: 31440kb

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: 2986ms
memory: 31424kb

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: 878ms
memory: 31552kb

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: 4340ms
memory: 31448kb

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: 3484ms
memory: 31508kb

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: 4390ms
memory: 31496kb

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: 3329ms
memory: 31432kb

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: 3550ms
memory: 31508kb

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: 4879ms
memory: 31548kb

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: 3606ms
memory: 31508kb

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: 3673ms
memory: 31564kb

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: 4417ms
memory: 31580kb

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: 3507ms
memory: 31564kb

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: 4656ms
memory: 31564kb

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: 4471ms
memory: 31436kb

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: 4612ms
memory: 31552kb

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: 4177ms
memory: 31564kb

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: 3912ms
memory: 31440kb

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: 3461ms
memory: 31556kb

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: 1150ms
memory: 31552kb

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