QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#119520#6669. MapaLaurie#0 72ms6772kbC++147.5kb2023-07-05 12:09:092024-07-04 00:17:23

Judging History

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

  • [2024-07-04 00:17:23]
  • 评测
  • 测评结果:0
  • 用时:72ms
  • 内存:6772kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-05 12:09:09]
  • 提交

answer

#ifndef __x86_64__
#error Only x86-64 targets are supported
#endif
#include<bits/stdc++.h>
#define __builtin_ia32_adc(x,y,flag) __asm__("addb   %3, %0\n\t" "adcq   %2, %1\n\t" "setc   %0":"+r"(flag),"+r"(x):"r"(y),"i"(-1):"cc")
#define itn int
#define nit int
#define ll long long
#define ms multiset
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define re register
#define ri re int
#define il inline
#define pii pair<int,int>
#define cp complex<double>
#define vi vector<int>
#define ull unsigned long long
#define mem0(x) memset(x,0,sizeof(x))
#define mem0x3f(x) memset(x,0x3f,sizeof(x))

struct bigint{// made by dengyaotriangle!
    typedef unsigned long long u64;
    typedef unsigned __int128 u128;
    typedef std::size_t st;
    std::vector<u64> data;
    bigint(){}
    bigint(u64 x):data(x?std::vector<u64>{x}:std::vector<u64>{}){}
    bigint(const std::string &s){
        st pos=s.length();
        int cnt=0;
        u64 val=0;
        while(pos){
            pos--;
            if(cnt==64){
                data.push_back(val);
                val=0;cnt=0;
            }
            val|=(u64)(s[pos]=='1')<<cnt;
            ++cnt;
        }
        if(cnt&&val)data.push_back(val);
    }
    explicit operator std::string()const{
        if(data.empty())return "0";
        bool t=0;
        std::string ret;
        for(int i=63;i>=0;i--){
            t|=(data.back()>>i)&1;
            if(t)ret+='0'|((data.back()>>i)&1);
        }
        st i=data.size()-1;
        while(i){
            i--;
            for(int j=63;j>=0;j--)ret+='0'|((data[i]>>j)&1);
        }
        return ret;
    }
    explicit operator bool()const{return !data.empty();}
    explicit operator u64()const{return data.empty()?0:data[0];}
    st digit()const{
        if(data.empty())return 0;
        return (data.size()<<6)-__builtin_clzll(data.back());
    }
    bool operator==(const bigint &a)const{return a.data==data;}
    bool operator!=(const bigint &a)const{return a.data!=data;}
    bool operator<(const bigint &a)const{
        if(data.size()!=a.data.size())return data.size()<a.data.size();
        for(st i=data.size();i;){
            i--;
            if(data[i]!=a.data[i])return data[i]<a.data[i];
        }
        return 0;
    }
    bool operator>(const bigint &a)const{return a<(*this);}
    bool operator<=(const bigint &a)const{return !(*this>a);}
    bool operator>=(const bigint &a)const{return !(*this<a);}
    bigint &operator<<=(st n){
        if(data.empty())return *this;
        int w=n&63;st z=n>>6;
        st i=data.size();
        bool flg=0;
        if(w&&(data.back()>>(64-w)))data.push_back(0),flg=1;
        data.resize(data.size()+z);
        while(i){
            i--;
            if(flg)data[i+z+1]|=data[i]>>(64-w);
            data[i+z]=data[i]<<w;
            flg|=bool(w);
        }
        for(st i=0;i<z;i++)data[i]=0;
        return *this;
    }
    bigint &operator>>=(st n){
        int w=n&63;st z=n>>6,i=0;
        for(;i+z<data.size();i++){
            if(w&&i)data[i-1]|=data[i+z]<<(64-w);
            data[i]=data[i+z]>>w;
        }
        while(data.size()>i)data.pop_back();
        while(!data.empty()&&data.back()==0)data.pop_back();
        return *this;
    }
    bigint operator<<(st n)const{return bigint(*this)<<=n;}
    bigint operator>>(st n)const{return bigint(*this)>>=n;}
    bigint &operator+=(const bigint &a){
        data.resize(std::max(data.size(),a.data.size()));
        bool carry=0;
        for(st i=0;i<data.size();i++){
            u64 rg=0;
            if(i<a.data.size())rg=a.data[i];
            __builtin_ia32_adc(data[i],rg,carry);
        }
        if(carry)data.push_back(1);
        return *this;
    }
    bigint &operator-=(const bigint &a){
        bool carry=1;
        for(st i=0;i<data.size();i++){
            u64 rg=-1;
            if(i<a.data.size())rg=~a.data[i];
            __builtin_ia32_adc(data[i],rg,carry);
        }
        while(!data.empty()&&data.back()==0)data.pop_back();
        return *this;
    }
    bigint &operator++(){return *this+=bigint(1);}
    bigint &operator--(){return *this-=bigint(1);}
    bigint operator++(int){bigint tmp=*this;++*this;return tmp;}
    bigint operator--(int){bigint tmp=*this;--*this;return tmp;}
    bigint &operator*=(const bigint &a){
        std::vector<u64> ret(data.size()+a.data.size());
        for(st i=0;i<data.size();i++){
            u64 carry=0; bool wcarry=0;
            st k=i;
            for(st j=0;j<a.data.size();j++,k++){
                u128 r=data[i]*(u128)a.data[j]+carry;
                u64 cur=r;
                carry=r>>64;
                __builtin_ia32_adc(ret[k],cur,wcarry);
            }
            while(carry||wcarry){
                __builtin_ia32_adc(ret[k],carry,wcarry);
                carry=0;k++;
            }
        }
        while(!ret.empty()&&ret.back()==0)ret.pop_back();
        data=ret;
        return *this;
    }
    bigint &operator/=(const bigint &a){
        if(a.digit()>digit()){
            data.clear();
            return *this;
        }
        st z=digit()-a.digit();
        std::vector<u64> ret;
        while(1){
            bigint tmp=a<<z;
            if(tmp<=*this){
                *this-=tmp;
                st v1=z>>6;
                if(ret.size()<=v1)ret.resize(v1+1);
                ret[v1]|=(u64)(1)<<(z&63);
            }
            if(!z)break;
            z--;
        }
        data=ret;
        return *this;
    }
    bigint &operator%=(const bigint &a){
        if(a.digit()>digit())return *this;
        st z=digit()-a.digit();
        while(1){
            bigint tmp=a<<z;
            if(tmp<=*this)*this-=tmp;
            if(!z)break;
            z--;
        }
        return *this;
    }
    bigint operator+(const bigint &a)const{return bigint(*this)+=a;}
    bigint operator-(const bigint &a)const{return bigint(*this)-=a;}
    bigint operator*(const bigint &a)const{return bigint(*this)*=a;}
    bigint operator/(const bigint &a)const{return bigint(*this)/=a;}
    bigint operator%(const bigint &a)const{return bigint(*this)%=a;}
};
std::istream &operator>>(std::istream &st,bigint &a){
    std::string s;st>>s;a=bigint(s);return st;
}
std::ostream &operator<<(std::ostream &st,const bigint &a){
	std::string s=(std::string)(a);
	std::cout<<s.size()<<std::endl;
    return st<<s;
}
using namespace std;
inline long long pw(long long x,long long p){
	int mod=p;
	p-=2;
    long long res=1;
    for(;p;p>>=1,x=x*x%mod)
        if(p&1)res=res*x%mod;
    return res;
}
int n,len,x[102],y[102],pri[1000002],cnt;
bool vis[1000002];
const int TT=35452321;
int main(){
	F(i,2,40000){
		for(int j=999999999/i*i+i;j<=1000000000+1000000;j+=i){
			vis[j-1000000000]=true;
		}
	}
	F(i,0,1000000)if(!vis[i])pri[cnt++]=i+1000000000;
	int T;cin>>T;
	if(T==1){
		cin>>n;
		F(i,1,n){
			cin>>x[i]>>y[i];
			x[i]^=TT;
			x[i]%=cnt;//cerr<<x[i]<<" ";
			x[i]=pri[x[i]];
		}
		bigint N=1,mi,sum=0;
		F(i,1,n){
			N*=x[i];
			mi=1;
			F(j,1,n)if(i!=j)mi*=x[j];
			sum+=(bigint)y[i]*(mi*pw((unsigned long long)(mi%x[i]),x[i]));
		}
		sum%=N;
		cout<<sum;
	}else{
		cin>>n;
		cin>>n;
		cin>>len;
		bigint sum=0;
		cin>>sum;
		F(i,1,n){
			cin>>x[i];
			x[i]^=TT;
			x[i]%=cnt;
			x[i]=pri[x[i]];
			cout<<(unsigned long long)(sum%x[i])<<endl;
		}
	}
	return 0;
}
/*
2
1111 1111 1111
100110011111110101001111001010011111100001110111110001111100001110100110111000111001110111
5
*/

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 100
Accepted
time: 66ms = 38ms + 28ms
memory: 5808kb,4664kb

input:

1
100
495528311 963488152
269613430 443544124
700489871 792354118
151890319 506569919
180452297 13229948
684464994 543841485
978085128 903812192
238355172 441140842
28061035 783291471
530823766 718942732
936853023 439421263
201361623 226633955
304644844 778868118
864860135 461524170
88300500 6959354...

output:

2989
1111001111011101111101000100110100000101011000001110101001110101101001011001101010011000101111000100010000010111011001110100001011000010010000111110010010001101000010000110010101110001011010111011000100111011110100010011110110100101010101001000011101100110010110010110011101101010101110110001001...

input:

2
100 79 2989
1111001111011101111101000100110100000101011000001110101001110101101001011001101010011000101111000100010000010111011001110100001011000010010000111110010010001101000010000110010101110001011010111011000100111011110100010011110110100101010101001000011101100110010110010110011101101010101110...

output:

310305144
821194635
174780370
903812192
805026231
996046536
439421263
645287342
90686849
20101025
440972097
543841485
176553522
249563964
461524170
348624865
848301562
506569919
306718453
206848250
382805509
278712030
964702808
868944393
493895143
39665197
574757075
441140842
785665865
229376884
551...

result:

points 1.0 ok K = 2989

Test #2:

score: 100
Accepted
time: 72ms = 40ms + 32ms
memory: 4800kb,4936kb

input:

1
100
743248071 842720888
367650901 130970775
297946283 705168964
771526942 537186020
245003150 707948455
643491261 668001146
311535032 293708068
183828318 18515526
593973840 915870006
102456762 64193833
729806890 839221652
47145974 35682954
668676377 228428310
370700393 569441954
250911162 48980047...

output:

2988
1000010001001001001100001011100111000110110101110011001001111011110000111111110110000100000111010100001110010110101111011000001100010011101001011111001000101111000101111011000000011011011101011100111000000011110111100101111101100111000100110010001100011010101010011000101101101101010000111101110...

input:

2
100 79 2988
1000010001001001001100001011100111000110110101110011001001111011110000111111110110000100000111010100001110010110101111011000001100010011101001011111001000101111000101111011000000011011011101011100111000000011110111100101111101100111000100110010001100011010101010011000101101101101010000...

output:

442563406
97578442
469403815
293708068
138158276
720700065
839221652
674386240
810209830
563527225
259979005
668001146
813899310
943777483
569441954
226088806
825435650
537186020
131383422
83733737
830289758
425793016
858146541
609883097
414389335
407054915
47572024
18515526
276587480
810627636
4972...

result:

points 1.0 ok K = 2988

Test #3:

score: 100
Accepted
time: 71ms = 39ms + 32ms
memory: 4804kb,5988kb

input:

1
100
770174568 168127255
893508708 185778664
976425263 477317099
287595878 512153851
621600374 418802856
818787535 612197605
796811122 566496677
789841517 873731343
43178468 619503942
597852289 471053284
66112404 635260765
158101403 199253397
680158192 123081916
626776438 29107026
721141470 5177084...

output:

2990
1001101010011011010010011110100000011010101111001010000000110011101110011011011011000111101001000001100100101010111111100101011001111000011100001010110110011110010110000110001101101010101010100101010011111111001110010010010001101000011100110110101001111110101000101010011000111011111010100100110...

input:

2
100 79 2990
1001101010011011010010011110100000011010101111001010000000110011101110011011011011000111101001000001100100101010111111100101011001111000011100001010110110011110010110000110001101101010101010100101010011111111001110010010010001101000011100110110101001111110101000101010011000111011111010...

output:

676203467
418593456
222540092
566496677
487711174
155177230
635260765
19655934
405420089
197948311
16997620
612197605
623431791
654167214
29107026
103769907
951695033
512153851
401411177
839097490
141196222
886472586
767476542
270436089
885084406
492744649
861074271
873731343
744691837
300804222
364...

result:

points 1.0 ok K = 2990

Test #4:

score: 100
Accepted
time: 71ms = 39ms + 32ms
memory: 6600kb,5944kb

input:

1
100
546594289 9670068
665528790 773039281
266567267 744830423
338924380 918542055
413001686 717894752
786408307 211692098
280986141 432842000
195582858 921321743
412109607 485887870
262421557 244551274
303481411 585109375
922835159 77375674
276669713 485047938
748493209 63888398
37129726 285918022...

output:

2989
1010001100010101001100111111110001011010001010000001011111001001100100100001101001011000110101001000000011001111000010110001001111010011010010100101010011110110110011100110100111011001001111001011101101111101100010001010111001000011100010000101111101100010011010011011110101100100100110001010111...

input:

2
100 79 2989
1010001100010101001100111111110001011010001010000001011111001001100100100001101001011000110101001000000011001111000010110001001111010011010010100101010011110110110011100110100111011001001111001011101101111101100010001010111001000011100010000101111101100010011010011011110101100100100110...

output:

43372101
204611063
352593757
432842000
142147490
891337416
585109375
743309504
647533065
464964608
876089821
211692098
955710889
971589766
63888398
781195091
748872098
918542055
738134414
271774069
559783342
631668225
32245370
502187994
978371138
563783889
900635155
921321743
760555399
270665755
276...

result:

points 1.0 ok K = 2989

Test #5:

score: 100
Accepted
time: 71ms = 39ms + 32ms
memory: 6272kb,6336kb

input:

1
100
326454605 159474960
11647328 932941462
367166680 626258331
846588658 385992166
148602944 380296908
32123445 521548223
146657758 872883623
78417135 361494853
902204073 975297913
50096537 520296997
687284103 420187394
93781442 87808395
503014564 573344902
720903126 546124141
87676450 646360824
9...

output:

2989
1110000101011100001001110111011010110001100011011110010010010011011010100111100110101001011010100010000101110111111110111000100001011000010110100000000100111011110001010101110001011001111101110010111110011001001011000111111001111011010111100111010011110110000011111011110110110001110100000011111...

input:

2
100 79 2989
1110000101011100001001110111011010110001100011011110010010010011011010100111100110101001011010100010000101110111111110111000100001011000010110100000000100111011110001010101110001011001111101110010111110011001001011000111111001111011010111100111010011110110000011111011110110110001110100...

output:

744601533
267129639
871217352
872883623
255371549
162360942
420187394
62984915
242781986
691399852
480380990
521548223
206206675
214089065
546124141
380557861
669664079
385992166
150840342
413877880
634078816
965530575
770169571
451364705
804171981
524846617
166621075
361494853
603970305
891038427
6...

result:

points 1.0 ok K = 2989

Test #6:

score: 100
Accepted
time: 71ms = 39ms + 32ms
memory: 6240kb,5968kb

input:

1
100
64333280 212072142
621741906 581061751
485561139 692210649
992259436 287935018
247191279 473618369
757620730 140577613
737479792 180977604
404566245 999575096
265846881 11981569
207666352 505750476
304958822 388901054
389584560 428620342
171809402 115660346
324907936 144402645
844495803 791121...

output:

2990
1000000010101011001010101101010001011101111100100001001100101100001011010101011010111001110010100000010001111000001111110000100001010010101011100010101100111100001111000101001101001001100010100100001001001000001001101010110011011000110110000100111011100001101011111011010011011010100101010111001...

input:

2
100 79 2990
1000000010101011001010101101010001011101111100100001001100101100001011010101011010111001110010100000010001111000001111110000100001010010101011100010101100111100001111000101001101001001100010100100001001001000001001101010110011011000110110000100111011100001101011111011010011011010100101...

output:

925952390
770406569
77034978
180977604
957934192
99668862
388901054
858699296
371495636
28514411
68070922
140577613
781757001
847250666
144402645
346058199
267461021
287935018
989151756
348668969
556273495
997895853
95321369
938341707
276009971
101428817
899728485
999575096
385642796
181794009
75258...

result:

points 1.0 ok K = 2990

Test #7:

score: 100
Accepted
time: 67ms = 39ms + 28ms
memory: 6592kb,5696kb

input:

1
100
38589601 573023388
6635272 692946586
153397181 811034102
859889237 493892802
259205483 364719660
954343124 427626481
959173918 753851930
975496695 577574806
311830132 29056811
509015429 310443549
588209966 697904208
31314024 836756664
249907127 458343750
355938610 284261099
221528639 337802970...

output:

2989
1011011000010001111000011100100010010001111011000101101110111110011001011010000000101101111011011111000101110101010111000000000001101100110001001000110000010001010100000001101010001111100010100111101111111101101111010010110010011111100010100000100110100110100011010011110010100001010100101001100...

input:

2
100 79 2989
1011011000010001111000011100100010010001111011000101101110111110011001011010000000101101111011011111000101110101010111000000000001101100110001001000110000010001010100000001101010001111100010100111101111111101101111010010110010011111100010100000100110100110100011010011110010100001010100...

output:

230017218
565349569
47782129
753851930
678112683
647428660
697904208
283703409
312668984
173256201
644234813
427626481
304813844
912323446
284261099
886592164
929134689
493892802
555567576
65699189
645479813
694103982
65190925
671520247
354050416
976551128
738019464
577574806
813237436
891060967
888...

result:

points 1.0 ok K = 2989

Test #8:

score: 100
Accepted
time: 67ms = 35ms + 32ms
memory: 4944kb,5776kb

input:

1
100
608812690 879292074
479028197 788306143
615995302 841820438
145257256 962764296
602711633 995581697
898256936 448106429
760128150 867194906
843820112 719060821
156799570 629004151
556234422 563271562
355032462 28734192
691911457 345245685
868932163 940932744
589136297 140594459
605248500 81637...

output:

2990
1000100010001000111001100111001011000000000000011011000100100111010000000001000111000111111000000101010110110101000100101010000011000011011001010110011000011000101010001110101110111100101100101010110100001011100111001100001001011100101000011010101010001011001011110001011000110101011010011100000...

input:

2
100 79 2990
1000100010001000111001100111001011000000000000011011000100100111010000000001000111000111111000000101010110110101000100101010000011000011011001010110011000011000101010001110101110111100101100101010110100001011100111001100001001011100101000011010101010001011001011110001011000110101011010...

output:

500331265
566760896
580044819
867194906
560949333
9781752
28734192
263251739
247143049
846291006
332847217
448106429
266605081
382040161
140594459
32445827
364204743
962764296
647363961
549897822
266248054
819012425
609835929
951476639
538336120
158314822
355385207
719060821
493794877
696188978
3014...

result:

points 1.0 ok K = 2990

Test #9:

score: 100
Accepted
time: 71ms = 39ms + 32ms
memory: 6436kb,6564kb

input:

1
100
221411475 163696773
580081552 897674994
529495152 42484057
439934490 746227851
716122469 137572309
850797298 158711960
820091048 515476547
797154090 246166696
923505280 368103965
246035210 308696941
613434683 955145371
875043135 212559533
205331778 121889189
468477922 194020296
861623799 72521...

output:

2989
1110001000011010100001011110001011011011110000100100111110110010110101110011100111111001110100010001000001000101101011101001011001011000111101011101111111100011011001001000001010010111111011101100001000101110100011000101100110000010111000100010101001111110101111100000110100010010011001000011001...

input:

2
100 79 2989
1110001000011010100001011110001011011011110000100100111110110010110101110011100111111001110100010001000001000101101011101001011001011000111101011101111111100011011001001000001010010111111011101100001000101110100011000101100110000010111000100010101001111110101111100000110100010010011001...

output:

447518344
20372800
820057525
515476547
929148550
975667875
955145371
710181675
270693487
815249231
444426161
158711960
978716476
472823181
194020296
768850245
118243886
746227851
939771652
880147346
23021000
674514174
170878417
120543464
688090699
772795972
659239901
246166696
22324283
62945716
4424...

result:

points 1.0 ok K = 2989

Test #10:

score: 100
Accepted
time: 71ms = 39ms + 32ms
memory: 6420kb,4960kb

input:

1
100
19599769 503599235
607852146 743568370
186281835 152620298
14504908 481672793
781288195 362834688
151340700 673227358
631578327 616559846
162406965 868151253
654902334 704640894
506151846 36830214
260055673 991685781
541724792 551734837
725627458 660315138
732278528 433696372
325821250 4876257...

output:

2988
1000001000010101001010001011001101110011100000000001010100001100100101011010010110101001010011110110101011101001110001000011001010010010011001001111101000010100101111110101010010000101010101110001001101101010000001101101110100000110000111000100100010011010000010010100110001001111001100001100110...

input:

2
100 79 2988
1000001000010101001010001011001101110011100000000001010100001100100101011010010110101001010011110110101011101001110001000011001010010010011001001111101000010100101111110101010010000101010101110001001101101010000001101101110100000110000111000100100010011010000010010100110001001111001100...

output:

17522166
203911209
128873662
616559846
5724752
637807633
991685781
667107960
23742057
733808995
34061776
673227358
76723239
80053091
433696372
302174338
804265440
481672793
129338272
820651206
457529317
578437883
142129496
92873118
115024862
323981695
456071005
868151253
79539206
533123847
250920833...

result:

points 1.0 ok K = 2988

Test #11:

score: 100
Accepted
time: 72ms = 40ms + 32ms
memory: 4776kb,6404kb

input:

1
100
754728080 615034506
278142947 739166255
431557648 213650106
801076937 12302465
390056764 405912325
958010191 972296266
618096674 290293214
816072144 822111433
114390542 264666411
362376476 262284198
397871046 932447079
740458746 280549044
401344771 621570565
158481121 162119017
575252154 10877...

output:

2989
1100101111000111110010111010001001100111010010101101110111101001101001101101111010000010100011001010100000010000111011100001000111111100111011000011111111001100000010001110100111001110101011101100010010110111001100001001001111101101001001100111010110010100000100100000001111001011010111010011111...

input:

2
100 79 2989
1100101111000111110010111010001001100111010010101101110111101001101001101101111010000010100011001010100000010000111011100001000111111100111011000011111111001100000010001110100111001110101011101100010010110111001100001001001111101101001001100111010110010100000100100000001111001011010111...

output:

956707937
764151542
425056403
290293214
904945055
569744963
932447079
578669827
615355462
437815230
175380679
972296266
707177724
779023842
162119017
102160143
489008046
12302465
71297359
937102868
844790648
930068047
918051016
375684910
653833961
85896778
97899197
822111433
333928660
394182386
2979...

result:

points 1.0 ok K = 2989

Test #12:

score: 100
Accepted
time: 72ms = 40ms + 32ms
memory: 6676kb,5856kb

input:

1
100
651602369 609971562
405806520 338858725
82461387 773296498
370394604 205907118
83229151 915559769
402520445 634368224
295827147 51732839
850231879 473145268
91650669 793908439
989299809 96921178
907891317 791908538
221803027 446090649
124079152 603405537
739157248 694680954
704470038 219741129...

output:

2987
1010000000110001001111010001110011011001001111111011100001011110100001011000110001000000001000001110100110001110100000001011100000100100001100001001110100111100111011101110101010100100100110010010010110001011001110111101001011000001000001000011011110111101110110000110111101101111011000111111101...

input:

2
100 79 2987
1010000000110001001111010001110011011001001111111011100001011110100001011000110001000000001000001110100110001110100000001011100000100100001100001001110100111100111011101110101010100100100110010010010110001011001110111101001011000001000001000011011110111101110110000110111101101111011000...

output:

304926408
871747385
695719855
51732839
30730873
858053531
791908538
890946266
742114626
147850369
963347495
634368224
56126240
294913872
694680954
413016011
3780006
205907118
980617161
660575727
27667900
592622098
681202212
760457383
415626677
428417886
570655471
473145268
966433960
923765677
553360...

result:

points 1.0 ok K = 2987

Test #13:

score: 100
Accepted
time: 71ms = 39ms + 32ms
memory: 4740kb,4708kb

input:

1
100
900905485 986849220
865890639 989219769
974980553 815503255
12084595 62574731
234049511 570118116
55567194 907451536
607443488 476001345
441446673 515273718
647029160 196634608
984700195 391421066
387033530 548761294
299636778 162002144
258531148 905788089
99288303 231936743
506688707 46687162...

output:

2985
1011111011100000111101100000111011110000001000111011011110000011101001000001100011010011110011010000000100101011100000011001011100000000110000010110110111010111111100111101001110111111101000001010101011011111011111000101101000001111111111111001110001111000111100101110011110111101111000011011110...

input:

2
100 79 2985
1011111011100000111101100000111011110000001000111011011110000011101001000001100011010011110011010000000100101011100000011001011100000000110000010110110111010111111100111101001110111111101000001010101011011111011111000101101000001111111111111001110001111000111100101110011110111101111000...

output:

806344887
664008030
73690163
476001345
211279038
879930441
548761294
308851136
443343152
782576630
352250016
907451536
584286144
374558469
231936743
760852838
985997701
62574731
372865777
828181419
656826593
577394566
759576483
515637769
769134727
778154760
263932789
515273718
69006606
294577561
498...

result:

points 1.0 ok K = 2985

Test #14:

score: 100
Accepted
time: 67ms = 35ms + 32ms
memory: 6772kb,6004kb

input:

1
100
100175674 328715935
971481682 194132780
717666444 504666299
330362693 977581115
872779535 597235480
375783505 452186384
419400050 627221988
600872811 553467292
201684227 507815487
95388868 719860800
820903171 665851948
43416948 800556305
277069166 53288802
376279049 298221064
161791895 1888138...

output:

2987
1110001010000100011011001101110111001011111111010101001100001000001001111100111111010010110101101110111001001000101001100000111000010110010011110110011010000000100011011111001000011011110000110010001010100100100101010100000110101100111011101101010000111001001000111001110101000001000010000110101...

input:

2
100 79 2987
1110001010000100011011001101110111001011111111010101001100001000001001111100111111010010110101101110111001001000101001100000111000010110010011110110011010000000100011011111001000011011110000110010001010100100100101010100000110101100111011101101010000111001001000111001110101000001000010...

output:

656202152
38139659
986245811
627221988
262987141
41626531
665851948
721346847
18937813
662860631
348766134
452186384
952646508
719733063
298221064
310596719
287953722
977581115
980528425
123043074
740357729
215128353
275085455
357145189
231768137
968678053
431885039
553467292
654066409
991017403
592...

result:

points 1.0 ok K = 2987

Test #15:

score: 100
Accepted
time: 71ms = 39ms + 32ms
memory: 4792kb,6036kb

input:

1
100
155759197 738116086
693067528 594897020
326890902 625583897
248669652 892268604
982863679 666422296
851843372 868420150
318485019 643582119
817328291 563713715
147817474 54748668
839462496 907507551
485479383 25930860
669573094 752904913
226916686 37390772
111822444 292076901
593570288 9599256...

output:

2989
1011101100011111011010110010101111000101001011100110101011001000110011100101000010011000110010110010101000011001100111100101000111111000101010000110010001110100111110110011101011001001100001100011010011010111010101011100101111010101100110001100101000101010001111000110011001000000001100010110001...

input:

2
100 79 2989
1011101100011111011010110010101111000101001011100110101011001000110011100101000010011000110010110010101000011001100111100101000111111000101010000110010001110100111110110011101011001001100001100011010011010111010101011100101111010101100110001100101000101010001111000110011001000000001100...

output:

237700952
431918470
552117997
643582119
179644804
592543520
25930860
71700147
515536454
240714551
904270220
868420150
409900083
236315209
292076901
682237796
969917168
892268604
730750810
677248102
964094246
746774159
915185427
483386475
303613984
892436193
535058636
563713715
208906352
365661664
70...

result:

points 1.0 ok K = 2989

Test #16:

score: 100
Accepted
time: 71ms = 38ms + 33ms
memory: 4784kb,4704kb

input:

1
100
528691319 91831880
386349345 731326576
21176008 940098540
325859753 762337780
713581844 897308394
774875332 625809049
252347069 294035274
623069253 468083716
648169883 510534328
99296629 772471648
385338480 58002281
223045398 430841708
313950768 22827747
173102112 767986059
540475972 562649334...

output:

2990
1101100000001000100011111100111000011000011000001011010001000101100101010100111011000101001000001100111111000101000100110101111111101100110001010101011000111101000000110000100010000101110111000000000011110000000011000011111101111011011100001101000101011111111100000001011100100111110111001101000...

input:

2
100 79 2990
1101100000001000100011111100111000011000011000001011010001000101100101010100111011000101001000001100111111000101000100110101111111101100110001010101011000111101000000110000100010000101110111000000000011110000000011000011111101111011011100001101000101011111111100000001011100100111110111...

output:

525791347
67606394
423041096
294035274
505042001
36069272
58002281
486356778
736546059
708625946
554916860
625809049
239334507
588411226
767986059
447213639
540326718
762337780
504417370
41031618
377948179
599950989
278829818
167509922
486272562
158889968
701081566
468083716
585296033
674626268
7669...

result:

points 1.0 ok K = 2990

Test #17:

score: 0
Wrong Answer
time: 67ms = 35ms + 32ms
memory: 6444kb,6768kb

input:

1
100
670714199 899616316
329702868 22625676
609441993 414274788
231301804 982523317
499797027 829951970
554440084 606392830
416502025 91330445
765840045 291414099
955527229 697408403
468888699 842546173
140134565 404507934
469199432 692339096
392093128 681468648
224453201 253441757
536866309 687113...

output:

2984
1101110001011101100000110101110111001000010100011001001001001000110010100111011000110101011111101111101000111010000100110001001111010000111110111001100110010001101011100001100011111110110001110001010100001100110001101001010000010010010111000110001011111011110110101111001010000011011000100000110...

input:

2
100 79 2984
1101110001011101100000110101110111001000010100011001001001001000110010100111011000110101011111101111101000111010000100110001001111010000111110111001100110010001101011100001100011111110110001110001010100001100110001101001010000010010010111000110001011111011110110101111001010000011011000...

output:

242761459
143380783
210207234
91330445
429281488
593964600
404507934
994543054
389733156
263001270
548956961
606392830
332393935
547574592
253441757
463394561
905379537
982523317
900985807
641084668
253229006
698233960
999741433
286544104
597913890
717679349
758596846
291414099
465760688
831854537
3...

result:

wrong answer wrong answer on query #61: read 0 but expected 845791367