QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#75606#4917. 中奖率4182_543_73141 85ms3704kbC++203.5kb2023-02-05 21:36:322023-02-05 21:36:39

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-05 21:36:39]
  • 评测
  • 测评结果:41
  • 用时:85ms
  • 内存:3704kb
  • [2023-02-05 21:36:32]
  • 提交

answer

#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
//simple integer
#define ll long long
ll bs=1e18;
struct integer{
	vector<ll> v;
	explicit operator bool()const{return !v.empty();}
	void add(ll a)
	{
		ll rs=a;
		for(int i=0;rs;i++)
		{
			if(i>=v.size())v.push_back(0);
			rs+=v[i];
			v[i]=rs%bs;
			rs/=bs;
		}
	}
	void mul(ll a)
	{
		__int128 rs=0;
		for(int i=0;i<v.size()||rs;i++)
		{
			if(i>=v.size())v.push_back(0);
			rs+=(__int128)a*v[i];
			v[i]=rs%bs;
			rs/=bs;
		}
	}
	void div(ll a)
	{
		int sz=v.size();
		ll rs=0;
		for(int i=sz-1;i>=0;i--)
		{
			__int128 ri=(__int128)bs*rs+v[i];
			v[i]=ri/a;rs=ri%a;
		}
		while(v.size()&&v.back()==0)v.pop_back();
	}
	ll mod(ll a)
	{
		int sz=v.size();
		ll rs=0;
		for(int i=sz-1;i>=0;i--)
		{
			__int128 ri=(__int128)bs*rs+v[i];
			rs=ri%a;
		}
		return rs;
	}
};
#define N 105000
char s[N];
integer input()
{
	integer si;
	scanf("%s",s+1);
	ll s1=1,s2=0;
	int le=1;
	while(s[le+1])le++;
	while(le)
	{
		s2+=s1*(s[le]-'0');s1*=10;
		if(s1==bs)si.v.push_back(s2),s1=1,s2=0;
		le--;
	}
	if(s2)si.v.push_back(s2);
	return si;
}
void output(integer s)
{
	if(!s){printf("0\n");return;}
	printf("%lld",s.v.back());
	for(int i=(int)s.v.size()-2;i>=0;i--)printf("%018lld",s.v[i]);
	printf("\n");
}
int n,q,a,su[N],fg;
ll calc(ll a,ll b)
{
	ll si=0;
	//sum la*s/lx/n-i/n
	for(int i=1;i<=n;i++)if(1ll*su[i]*n>1ll*su[n]*i)
	{
		ll la=1ll*su[i]*n-1ll*su[n]*i;
		ll ri=la*a+b*n-i*b;
		si+=ri/n/b;
	}
	return si;
}
void query1(integer s)
{
	if(!fg)
	{
		int ci=0;
		for(int i=1;i<=n;i++)if(1ll*su[i]*n==1ll*su[n]*i)ci++;
		int ri=s.mod(ci);
		s.div(ci);s.mul(n);
		for(int i=1;i<=n;i++)if(1ll*su[i]*n==1ll*su[n]*i)
		{
			ri--;
			if(!ri)s.add(i);
		}
		output(s);
		return;
	}
	ll s1=0;
	for(int i=1;i<=n;i++)if(1ll*su[i]*n>1ll*su[n]*i)s1+=1ll*su[i]*n-1ll*su[n]*i;
	ll re=s.mod(s1);s.div(s1);
	if(s)s.add(-1),re+=s1;
	ll lb=0,rb=2ll*n*n*n,fr=1ll*n*n,as=0;
	while(lb<=rb)
	{
		ll mid=(lb+rb)>>1;
		if(calc(mid,fr)<re)as=mid,lb=mid+1;
		else rb=mid-1;
	}
	re-=calc(as,fr);
	vector<pair<ll,int> > tp;
	for(int i=1;i<=n;i++)if(1ll*su[i]*n>1ll*su[n]*i)
	{
		ll la=1ll*su[i]*n-1ll*su[n]*i;
		__int128 ri=(__int128)la*as+fr*n-i*fr;
		if(ri/n/fr!=(ri+la)/n/fr)tp.push_back(make_pair(la,i));
	}
	sort(tp.begin(),tp.end());
	int sx=tp[re-1].second;
	ll ry=(__int128)(as+1)*(1ll*su[sx]*n-1ll*su[n]*sx)/fr;
	s.mul(1ll*su[sx]*n-1ll*su[n]*sx);s.mul(n);s.add(ry);
	output(s);
}
void query2(integer s)
{
	int id=s.mod(n);
	if(!id)id=n;
	if(1ll*su[id]*n<1ll*su[n]*id||(1ll*su[id]*n==1ll*su[n]*id&&fg)){printf("inf\n");return;}
	if(1ll*su[id]*n==1ll*su[n]*id)
	{
		s.div(n);
		int ci=0,c2=0;
		for(int i=1;i<=n;i++)if(1ll*su[i]*n==1ll*su[n]*i)ci++,c2+=id<n&&i<=id;
		s.mul(ci);s.add(c2);
		output(s);
		return;
	}
	ll lx=1ll*su[id]*n-1ll*su[n]*id,rs=lx*n,ri=s.mod(rs);
	s.div(rs);
	if(s)s.add(-1),ri+=rs;
	ll s1=0;
	for(int i=1;i<=n;i++)if(1ll*su[i]*n>1ll*su[n]*i)s1+=1ll*su[i]*n-1ll*su[n]*i;
	s.mul(s1);
	//sum la*s/lx/n-i/n
	for(int i=1;i<=n;i++)if(1ll*su[i]*n>1ll*su[n]*i)
	{
		ll la=1ll*su[i]*n-1ll*su[n]*i;
		__int128 r1=(__int128)la*ri-i*lx-(la>lx)+n*lx;
		s.add(r1/n/lx);
	}
	output(s);
}
int main()
{
	scanf("%d%d%s",&n,&q,s+1);
	for(int i=1;i<=n;i++)su[i]=su[i-1]+s[i]-'0';
	for(int i=1;i<n;i++)if(1ll*su[i]*n>1ll*su[n]*i)fg=1;
	while(q--)
	{
		scanf("%d",&a);integer b=input();
		if(a==1)query1(b);else query2(b);
	}
}

详细

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 2ms
memory: 3536kb

input:

93594 19
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

803592238894397000180010742478410576139869323112765266001511168406933953751236048305575854734087992434865734898666775073462056595681265138821122297618629090129568166018988058397842512784043408247048475083486672197520209680936205310495190027161434933868319162317581353076485586012510746832534790123318...

result:

ok 19 tokens

Test #2:

score: 0
Accepted
time: 6ms
memory: 3592kb

input:

91106 19
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

inf
inf
inf
inf
13250042107896464722639737551541466942179901318817839832766590049487752727865912250795382770204236165270082111796839055561744227636073331650212700910581348097835459150251688363718468552900251250148301582337176568548165076825749090832639499887382431511630515262690992013373658775659429...

result:

ok 19 tokens

Test #3:

score: 0
Accepted
time: 6ms
memory: 3504kb

input:

91004 19
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

615583033926412665379213953324038024217834471026294801388188380855415202841104551684169952830165295737948000277599376689161324741020690179665753283567317214074727589342722310194779455556310818004374376474764064937590258429980614187691752943635481928305924995147441001944209678975366299644962193997878...

result:

ok 19 tokens

Test #4:

score: 0
Accepted
time: 3ms
memory: 3512kb

input:

90255 20
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

499599650596627581409270516073361171534798169651401128905539595097904284149229507117902151246635636602106763929398082171217870421053986702009355855535129786260850675383419648681127018158100775558533952949402381637753162134550874268417162202985795686214400585039764184003031446966858170110874690477358...

result:

ok 20 tokens

Test #5:

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

input:

91120 20
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

inf
79720591846983829206255887296207669486915366790122276434980101585360431827746713261002508648352372575865363390100523993630288523905911853973318127707889991724762296859274660492425147944952897963807830595800561901914978699828863421552748209566274991181115114248717641246059782816631387147071628022...

result:

ok 20 tokens

Subtask #2:

score: 9
Accepted

Test #6:

score: 9
Accepted
time: 1ms
memory: 2980kb

input:

10 19
0000000000
2 241
1 405
1 927
1 669
1 734
1 349
2 493
1 828
1 385
1 855
2 761
1 63
1 288
1 754
2 91
1 863
2 805
2 1000
1 1000

output:

241
405
927
669
734
349
493
828
385
855
761
63
288
754
91
863
805
1000
1000

result:

ok 19 tokens

Test #7:

score: 0
Accepted
time: 1ms
memory: 2992kb

input:

10 20
1111111111
2 112
2 917
1 364
1 898
1 37
2 456
2 839
1 414
1 13
1 858
2 49
2 653
2 502
1 562
1 138
2 559
2 778
2 494
2 1000
1 1000

output:

112
917
364
898
37
456
839
414
13
858
49
653
502
562
138
559
778
494
1000
1000

result:

ok 20 tokens

Test #8:

score: 0
Accepted
time: 0ms
memory: 3044kb

input:

10 20
1000000001
1 490
1 300
2 143
2 151
2 665
1 539
2 412
2 160
1 377
1 2
2 730
2 724
1 99
1 242
1 824
1 448
2 171
1 355
2 1000
1 1000

output:

1951
1191
73
40
inf
1612
139
inf
1501
2
inf
725
292
722
3291
893
44
354
inf
3991

result:

ok 20 tokens

Test #9:

score: 0
Accepted
time: 2ms
memory: 3128kb

input:

10 19
1101011111
2 84
2 777
1 278
1 396
1 795
2 487
1 102
1 408
2 502
1 786
1 419
1 431
1 722
1 826
2 66
1 545
2 334
2 1000
1 1000

output:

inf
inf
1842
2632
5292
inf
672
2712
77
5232
2782
2862
4802
2751
inf
3622
inf
inf
3331

result:

ok 19 tokens

Test #10:

score: 0
Accepted
time: 2ms
memory: 3128kb

input:

10 19
0101001111
1 718
1 477
2 994
2 205
2 432
2 650
1 358
2 497
2 22
1 549
1 506
2 856
2 564
1 891
2 2
1 970
1 211
2 1000
1 1000

output:

7180
4770
inf
inf
inf
65
3580
inf
inf
5490
5060
inf
inf
8910
inf
9700
2110
100
10000

result:

ok 19 tokens

Test #11:

score: 0
Accepted
time: 2ms
memory: 2980kb

input:

10 20
1000000000
2 219
2 205
1 392
2 750
2 415
1 768
1 997
2 833
1 354
1 565
2 106
2 552
2 336
1 865
1 319
1 343
1 576
2 945
2 1000
1 1000

output:

982
185
435
inf
374
1193
886
538
237
377
119
314
378
577
424
533
1151
851
inf
667

result:

ok 20 tokens

Test #12:

score: 0
Accepted
time: 0ms
memory: 3196kb

input:

8 20
11110110
2 831
1 724
2 234
2 180
2 86
1 419
2 862
2 587
2 393
1 169
2 606
1 370
1 555
1 498
1 222
1 321
1 142
2 698
2 1000
1 1000

output:

555
1444
234
92
86
627
862
392
785
85
606
370
831
498
222
161
142
698
inf
1499

result:

ok 20 tokens

Test #13:

score: 0
Accepted
time: 2ms
memory: 3112kb

input:

10 20
1011111111
1 204
2 208
2 915
1 290
2 331
2 426
1 685
1 744
2 374
2 28
2 832
2 72
1 264
2 93
1 791
1 995
2 687
2 715
2 1000
1 1000

output:

2031
inf
inf
2891
34
inf
6841
7431
inf
inf
inf
inf
2631
inf
7901
9941
inf
inf
inf
9991

result:

ok 20 tokens

Test #14:

score: 0
Accepted
time: 2ms
memory: 3048kb

input:

10 19
0100100010
1 316
2 321
2 229
1 947
1 734
1 656
2 42
2 467
2 729
2 414
2 146
2 766
2 514
2 218
1 757
2 279
1 980
2 1000
1 1000

output:

842
inf
115
3155
2445
2185
16
inf
365
inf
109
574
inf
inf
2515
140
1959
inf
1999

result:

ok 19 tokens

Test #15:

score: 0
Accepted
time: 1ms
memory: 3200kb

input:

10 20
1000110010
2 132
2 288
1 716
2 939
2 146
1 354
2 313
1 214
2 291
1 710
2 109
1 142
1 266
1 339
1 180
1 259
2 717
1 17
2 1000
1 1000

output:

132
inf
2146
470
49
1061
inf
641
98
1419
55
142
796
1016
359
776
717
17
inf
1999

result:

ok 20 tokens

Subtask #3:

score: 0
Runtime Error

Dependency #2:

100%
Accepted

Test #16:

score: 9
Accepted
time: 4ms
memory: 3508kb

input:

96819 19
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

699771300
861286816
747345185
309822250
669300879
348051855
803856551
917004158
48514529
943411183
678753546
100896344
42516464
542123409
541302510
128941120
763029472
1000000000
1000000000

result:

ok 19 tokens

Test #17:

score: 0
Accepted
time: 2ms
memory: 3492kb

input:

92557 20
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

509322688
996739600
89495790
998716029
312248924
559737383
457422881
953859671
572963358
856570461
762291264
223198547
58794243
173324132
835097014
155380135
848188162
222373530
1000000000
1000000000

result:

ok 20 tokens

Test #18:

score: -9
Runtime Error

input:

95516 19
101000010010000010100000010010000000001010000000100101011100110001001011000010000100000000100010000001010000000000001000010000000110010000000010001001000010001000000000001000110000000000001001000000000100100000010010101000100001100010100010000100000001010000010110000110000010000000000000010...

output:


result:


Subtask #4:

score: 13
Accepted

Test #26:

score: 13
Accepted
time: 8ms
memory: 3596kb

input:

91666 20
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

515706124162066910404299759270263525075572767596736003465355923316260588149010617187359188941516324390245173109156994742981144311903350592651694874773059936377465166504183446390352558958540404515986128670780159685531688747924073414308447680356209302719213735419339034163216206854876449919662582900737...

result:

ok 20 tokens

Test #27:

score: 0
Accepted
time: 2ms
memory: 3656kb

input:

91047 20
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

748490273573792980373170496345932289792264023510501461386640731746530837775985011360693655655538352612548991850863544262166372647195373109391450350236987371183192812616376657263677465623740226504269832462386067930101999093116909436323318899728117997747067096632539706580241112266144163828519249301668...

result:

ok 20 tokens

Test #28:

score: 0
Accepted
time: 13ms
memory: 3552kb

input:

92486 19
110100000000000000110000000000100000000000000011000001001000010000010000000000100100001000000001101000000001011100000100010000000000000010000010001001000000000000000000000010000010001101000000001010010010000001000000110001100110000100101100001001100100100000000000010000000000000001010110000...

output:

inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
65986075054599739720012701630831185271110376577710956354155795249031175809009390746092705206288087294293403254292953327740384132264386725134793857054678394086844847065095541776644414503257258213388206060729019472813862535764008464101493529685679752732762570081...

result:

ok 19 tokens

Test #29:

score: 0
Accepted
time: 20ms
memory: 3592kb

input:

90758 19
111001110101010111100000111111011011001010101101110101111111101000011100011111111010111111010110011111001010111111101110101110010110110111000011110110111001100100001010011001010001110111011110111111111101110110111001101110101100111010010111100011000101101110011011111101110111100011110111111...

output:

337152640595339377254913355446254892275950588290486782075348462146043348153437383075163218482882384949983968092847114987978727985457664584745249748842150893129020441591183196333370705055984869426758646982814357613345456867523827515149962034146732136117858448360902802565799798832441703259791269764809...

result:

ok 19 tokens

Test #30:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

95944 20
010111110111111111001111111111101111111011111011011101101110111111111101101111111111111111111111111111101011011110111111111111111111111111111110111101111111110111101110011111111111111111111101101101101111111111110110111111101111111101101111111101111111111111111111101111111111110100011101111...

output:

inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf

result:

ok 20 tokens

Test #31:

score: 0
Accepted
time: 85ms
memory: 3524kb

input:

92585 20
110011011000101000000101010010100000000100000001110010010001100110001000100000100100000000111110001000000001000001100000110001001010000000101100000010100100001011010000001100000011000100011001000100000010010100001101000001110100001000011100010110100000100000101000010000000101000000100010010...

output:

693151164353298294991771915092246165588784011427723401514863569537180974110856679276502848848450095232556023520581621103706505329485541531644093395334224709813099430572342689943389061768308122334167396889122558885489842353859845505679740760989001467096316722773918455965593584892515339969002792035902...

result:

ok 20 tokens

Test #32:

score: 0
Accepted
time: 80ms
memory: 3704kb

input:

100000 19
11010101011011001011010111100000010010101100101010111000101110101001010110011011010011100100011110010011010011110111000100110000001111110010101000011111010011011101001100000000101011110100100100101100101010101100110111010011000101110111010110101000010110001010111110001010110100110000001111...

output:

171664461199134562766995650684440673085489422465326109270356812483138547934706911599756894207664574188038519627617045518815980608296136814038903827336872029429200125283024307872759381900102481215772231730929597377309317705827303189555946879704202361491952110134028530508207284059394040436511100411837...

result:

ok 19 tokens

Test #33:

score: 0
Accepted
time: 10ms
memory: 3660kb

input:

90139 20
101101100100111111111011100111110110111001111101101101110111011101011100111110111010110111101110110111101011011101100111110111011011101101110111101011011101101110101111101011101100111110101111011101101110110101111001111101101110110011111011101110110110111001101111101110011111011011101101110...

output:

114295361082305127942208281911086652195193612036965258194540554839765604416562780276165239338044991656166078586296137971810820270121979910956362520343058615413830387682572956846149751679906531190159869196033901257029539803703475752647797700268137583373220831250186514085304302366054423749897416545653...

result:

ok 20 tokens

Test #34:

score: 0
Accepted
time: 0ms
memory: 3472kb

input:

98059 19
101111111111111111011011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111111111111111011111111111111111...

output:

inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf
inf

result:

ok 19 tokens

Test #35:

score: 0
Accepted
time: 14ms
memory: 3512kb

input:

90139 20
101101100100111111111011100111110110111001111101101101110111011101011100111110111010110111101110110111101011011101100111110111011011101101110111101011011101101110101111101011101100111110101111011101101110110101111001111101101110110011111011101110110110111001101111101110011111011011101101110...

output:

114295361082305127942208281911086652195193612036965258194540554839765604416562780276165239338044991656166078586296137971810820270121979910956362520343058615413830387682572956846149751679906531190159869196033901257029539803703475752647797700268137583373220831250186514085304302366054423749897416545653...

result:

ok 20 tokens

Subtask #5:

score: 0
Runtime Error

Test #36:

score: 0
Runtime Error

input:

98506 19
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:


result:


Subtask #6:

score: 18
Accepted

Dependency #2:

100%
Accepted

Test #41:

score: 18
Accepted
time: 8ms
memory: 3108kb

input:

190 19
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2 3030536584264275991656446184192931032142342202853788773124469117132936126944321526393387980895665026...

output:

303053658426427599165644618419293103214234220285378877312446911713293612694432152639338798089566502665575779543814797512740930993972387315159956432349381665458354645284037027514891865835605478519158667178660184697604213917963871214214812993111821807966534988024828960583750304242594098806161798042315...

result:

ok 19 tokens

Test #42:

score: 0
Accepted
time: 6ms
memory: 3084kb

input:

193 19
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1 1351772618151481423230177086652803238158508064486406797357216616385709633380157485598761110616759...

output:

135177261815148142323017708665280323815850806448640679735721661638570963338015748559876111061675986698273716658276773734390827561113116964538186189052478876635588737990551692498234494057058003059839751209829199035845447832974080800145478641135936706193078823264491086923999420322165582774203161595102...

result:

ok 19 tokens

Test #43:

score: 0
Accepted
time: 6ms
memory: 3112kb

input:

190 19
0000000011010110000100000000010000000000000000000100010000000000000000010100000111000001010000000011000001000000000000000000000000010010110101000011000000000000100000000000000000000000010010
1 7025546092138551598322506344609083764370337686180747350121879133435593878050481996018963226269128116...

output:

121066315045921793195200592070648049655182238067889414547155845804375798542180628895704193688487901135863687255971248858541143901463046375455959397730944384192574836173285774465365427926461293985125013936864584936350168615280937114979940883153218796189556449143484390864297448295233235970026936487842...

result:

ok 19 tokens

Test #44:

score: 0
Accepted
time: 6ms
memory: 3080kb

input:

192 20
110000000000000000011000010000110111001100000010100010001001101110000100100011001011000001000000001001001001010000000100010000100010000000000010010111000000000000001000001110100100110001100100
2 51479842325970730010319087287497995149596274445858463282007641826381091860094358712133023804622138...

output:

inf
38341998613194711610851598392376329213398429862236791722758429828646326206870946489490519963026620278136704108955473770401179989284259951741936057704130095473505373978595010127371825804565979665889636708149937481617973071629996787507036030381953952077912690620515217533760857971046867181877030987...

result:

ok 20 tokens

Test #45:

score: 0
Accepted
time: 0ms
memory: 3076kb

input:

196 20
0000001000111101011010100011000010000101011011110010010001001000100111000101100101001111001010010011000100000111110110001101001010100000101101110100100000001000011101111101010000100111011000101011
1 5015320864439209304113353314551060919088155080394686712838786263814988191390498501749844810680...

output:

983002889430085023606217249652007940141278395757358595716402107707737685512537706342969582893376081409407560680631350221655106602096322436309682564428967871040525844907753791470991421295721108784719338314023419167873478652184575613811169808572719480004991417722134184854576650304466492357556422463891...

result:

ok 20 tokens

Test #46:

score: 0
Accepted
time: 8ms
memory: 3092kb

input:

194 20
11011011110101101111101100110110101101111111011000111110111101111111111110101101111100111000100101111111100101011100110100011001010110011111101011110101111101011101010111001010011100100011101010
1 841496047844694106271899368968881221632199488715438957442647728849671943144930052559312457648223...

output:

891504250247790381112709236090289423357957492080039511773428701730686930228377839982132933854757846565323633322867282290995678030292425283974968227167227130246366960144042655498999943869557004317637813542338734912429234258824024567967120930328757422981159724306506145045239740956838608794789118224561...

result:

ok 20 tokens

Test #47:

score: 0
Accepted
time: 7ms
memory: 3152kb

input:

198 19
100110000110000111000000110000110010010100100011000000100110100010011110000000000100101100010011100000001000110100100000101000100100111010010000001000101000101001000100100100100110001000100101001000
2 35268317002431184701422245442405829000005923579945992741874795798460235954723010375715676030...

output:

188097690679632985074251975692831088000031592426378627956665577591787925091856055337150272161223232461075499593059212126413825718672976251812558867468696130695110574802879014919091206063605134554089047800467112022986558512528893907722423493493816444748847965076074729184451781829746238206659222584006...

result:

ok 19 tokens

Test #48:

score: 0
Accepted
time: 6ms
memory: 3100kb

input:

199 20
1000100010001000110000000010100010001000100010001000100010000100110000001000100010001000100010001100000010001000101000001000110000001000100010001000100001001000100010001000100010000010100100001000010
2 9920712460050181008040669786206611702734689138566783308194618736710864209338567704897309905...

output:

137780749052581345532524628751902126097653251792532398834285816751681663108339027610100202261210293919458371492650808877579565823149430999460191591192171578233591292569082476673858256583027045372506280728359601893043627060360779272172294102411578650200602856181121172884178186372659597881229494321504...

result:

ok 20 tokens

Test #49:

score: 0
Accepted
time: 4ms
memory: 3100kb

input:

191 20
10111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111
2 708525660737406064209605877955610699402495358097794658985099436654795878211525631427013176482016048...

output:

inf
inf
4764927063424643385341316766894784077864447120347285019511038095835913836667468759882261308236894726769820585012982456865154319735565724505528756774276804286509553413096771267207786515671233882308497257886626356998534713361777345209974300706236027393518835957128358317338182290033572959471779...

result:

ok 20 tokens

Test #50:

score: 0
Accepted
time: 2ms
memory: 3072kb

input:

196 20
0101010100101010000110101010010101001010101001010100011001010111000010100110100010101001010010101010010100101010001101001001101010010001100110010110001010100101010010100101010010101001001101000110
1 3551825666225435715140441769407013363202718798956997020423487134473591163156979354572547081663...

output:

106690855261331095811115185717053581484710020627673780230345360667712470188316927738884172874481020065642522790344535637340588417934807971310354266142919040154634601403517324924829231747161526173417648078520507237523392804966603166147332292447888965648407387232298106862685661916582343133108491410284...

result:

ok 20 tokens

Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%