QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#75607 | #4917. 中奖率 | 4182_543_731 | 100 ✓ | 2781ms | 3704kb | C++20 | 3.5kb | 2023-02-05 21:40:05 | 2023-02-05 21:40:05 |
Judging History
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=n-i+la*(a/b)+(unsigned ll)(a%b)*la/b;
si+=ri/n;
}
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);
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 7ms
memory: 3552kb
input:
93594 19 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
803592238894397000180010742478410576139869323112765266001511168406933953751236048305575854734087992434865734898666775073462056595681265138821122297618629090129568166018988058397842512784043408247048475083486672197520209680936205310495190027161434933868319162317581353076485586012510746832534790123318...
result:
ok 19 tokens
Test #2:
score: 0
Accepted
time: 5ms
memory: 3596kb
input:
91106 19 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
inf inf inf inf 13250042107896464722639737551541466942179901318817839832766590049487752727865912250795382770204236165270082111796839055561744227636073331650212700910581348097835459150251688363718468552900251250148301582337176568548165076825749090832639499887382431511630515262690992013373658775659429...
result:
ok 19 tokens
Test #3:
score: 0
Accepted
time: 6ms
memory: 3528kb
input:
91004 19 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
615583033926412665379213953324038024217834471026294801388188380855415202841104551684169952830165295737948000277599376689161324741020690179665753283567317214074727589342722310194779455556310818004374376474764064937590258429980614187691752943635481928305924995147441001944209678975366299644962193997878...
result:
ok 19 tokens
Test #4:
score: 0
Accepted
time: 8ms
memory: 3488kb
input:
90255 20 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
499599650596627581409270516073361171534798169651401128905539595097904284149229507117902151246635636602106763929398082171217870421053986702009355855535129786260850675383419648681127018158100775558533952949402381637753162134550874268417162202985795686214400585039764184003031446966858170110874690477358...
result:
ok 20 tokens
Test #5:
score: 0
Accepted
time: 3ms
memory: 3516kb
input:
91120 20 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
inf 79720591846983829206255887296207669486915366790122276434980101585360431827746713261002508648352372575865363390100523993630288523905911853973318127707889991724762296859274660492425147944952897963807830595800561901914978699828863421552748209566274991181115114248717641246059782816631387147071628022...
result:
ok 20 tokens
Subtask #2:
score: 9
Accepted
Test #6:
score: 9
Accepted
time: 1ms
memory: 3112kb
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: 2ms
memory: 3044kb
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: 2ms
memory: 3020kb
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: 0ms
memory: 3048kb
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: 1ms
memory: 3112kb
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: 1ms
memory: 3048kb
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: 1ms
memory: 2976kb
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: 1ms
memory: 3048kb
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: 3052kb
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: 2ms
memory: 3004kb
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: 9
Accepted
Dependency #2:
100%
Accepted
Test #16:
score: 9
Accepted
time: 4ms
memory: 3512kb
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: 0ms
memory: 3504kb
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: 0
Accepted
time: 391ms
memory: 3488kb
input:
95516 19 101000010010000010100000010010000000001010000000100101011100110001001011000010000100000000100010000001010000000000001000010000000110010000000010001001000010001000000000001000110000000000001001000000000100100000010010101000100001100010100010000100000001010000010110000110000010000000000000010...
output:
1475811523 102935175 inf 4020340896 inf inf 5281420809 128315171 6194844474 1550373923 1520505611 inf inf 2426181408 inf inf 103627765 inf 3144469321
result:
ok 19 tokens
Test #19:
score: 0
Accepted
time: 868ms
memory: 3472kb
input:
99156 19 110011010101010100010000100110100100011010010101011000001000001100101000110101010101110001100100001010001001101111110101010111100000111101100101001000011000010100000100000110110011001000110000010001001110000000111110001111101110100000100010000010101011010101101011100100000110010001000110000...
output:
496345169 557032445 inf 887831302 398188831 3952809443 300475786 1292382458 1145629458 inf 3329812970 inf 2479850232 24067569 223285773 601460773 inf inf 3297788268
result:
ok 19 tokens
Test #20:
score: 0
Accepted
time: 4ms
memory: 3504kb
input:
94938 20 000001000010000010000001010000000000010100011011000000000000010100000000100010000010100000000000010000111000000100010010000100001001011000010000000000100011010000100110100010000000000010010010000000000101100011000000011000000100000000011100001000001111000011101000100001000010010000001000010...
output:
inf inf 82950030446844 inf 18347742184128 inf 35361371066334 86032879778088 46232511253602 inf 53060573069676 27934434175290 40306080085614 inf inf 29324315387544 40376168064114 inf inf 94938000000000
result:
ok 20 tokens
Test #21:
score: 0
Accepted
time: 1611ms
memory: 3524kb
input:
98383 19 111111111111101111111111111101111111111111101111111111111111111111111111111111111111111111111111111111111111111011111111111111111111111111110111111111111111111111111111111111111111111111111011110111111111111111111111111110110111111010111111111111111111101111111111111111110111111111111111111...
output:
1414537126 251822729 830542751 281752282 1198787193 499855054 1326252716 10322399 1101854792 18253665354 352537582 10994082382 1141649895 1016763700 477276384 662099438 1114010593 8246040944 1306137259
result:
ok 19 tokens
Test #22:
score: 0
Accepted
time: 1746ms
memory: 3596kb
input:
99995 19 101100110011000100110010011010001001101110011000100010100101110100000010101110100000111100001101101001000010110110111011010010100110100000000000101100010100101100011000110101110001110101100001001000010001100100111110001111100001001110111011100001000101011000010001110101100011011000010100001...
output:
1068175658 944686770 22235106 657045340 1502184933 121349463 1014525247 112751028 54232588 695983245 160240175 909343279 952427934 188856909 1465320003 2392294508 4341285759 2499286539 1391886583
result:
ok 19 tokens
Test #23:
score: 0
Accepted
time: 143ms
memory: 3480kb
input:
91670 19 101111111111110111111111001111111111111111111111111110111111111111011111111111110111111111110111111111111011111111111101111111111111011111111111101111111111111011111111111011111011111111111111111011111111101111111111111111101101111111111111111111111101111111111111011111111111011111111111101...
output:
inf 14988563640 10666530035 22886984864 inf inf inf inf inf 6314703826 inf 6124309155 11751587987 5800535998 inf 9837162679 2896666042 inf 15627315217
result:
ok 19 tokens
Test #24:
score: 0
Accepted
time: 745ms
memory: 3584kb
input:
95363 20 101010011010101011011001010110011010101001101011100010110101011010101010110011100111000101101010110010100111010101010110011010101010101011010101010101011010101010101011011001010011010110101001011011010101010101011011010011001011010101010101011010101010011011010101001101011010001110101011010...
output:
2844719449 2025956855 inf 331511068 99579260 inf inf 2313156941 2704914431 164632605 2629595835 inf inf 1460255351 16100312 249357973 302750317 2433581860 inf 14314044454
result:
ok 20 tokens
Test #25:
score: 0
Accepted
time: 327ms
memory: 3528kb
input:
100000 19 10011011010110110101011010110101101101010110110101011011010010110110111010110100111001110101011011010110100111100111010101110101010110011101011011010111001011010101011011101010110101101101011010011101101011000111101011011100110101101010110110101011010111011001101010110101101011010110111001...
output:
1189427251 159592368 280791443 inf inf 184688247 inf 774875123 inf 743122331 499213038 inf 194160538 inf inf inf inf inf 1958020038
result:
ok 19 tokens
Subtask #4:
score: 13
Accepted
Test #26:
score: 13
Accepted
time: 5ms
memory: 3512kb
input:
91666 20 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
515706124162066910404299759270263525075572767596736003465355923316260588149010617187359188941516324390245173109156994742981144311903350592651694874773059936377465166504183446390352558958540404515986128670780159685531688747924073414308447680356209302719213735419339034163216206854876449919662582900737...
result:
ok 20 tokens
Test #27:
score: 0
Accepted
time: 4ms
memory: 3580kb
input:
91047 20 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
748490273573792980373170496345932289792264023510501461386640731746530837775985011360693655655538352612548991850863544262166372647195373109391450350236987371183192812616376657263677465623740226504269832462386067930101999093116909436323318899728117997747067096632539706580241112266144163828519249301668...
result:
ok 20 tokens
Test #28:
score: 0
Accepted
time: 9ms
memory: 3520kb
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: 14ms
memory: 3588kb
input:
90758 19 111001110101010111100000111111011011001010101101110101111111101000011100011111111010111111010110011111001010111111101110101110010110110111000011110110111001100100001010011001010001110111011110111111111101110110111001101110101100111010010111100011000101101110011011111101110111100011110111111...
output:
337152640595339377254913355446254892275950588290486782075348462146043348153437383075163218482882384949983968092847114987978727985457664584745249748842150893129020441591183196333370705055984869426758646982814357613345456867523827515149962034146732136117858448360902802565799798832441703259791269764809...
result:
ok 19 tokens
Test #30:
score: 0
Accepted
time: 4ms
memory: 3476kb
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: 79ms
memory: 3672kb
input:
92585 20 110011011000101000000101010010100000000100000001110010010001100110001000100000100100000000111110001000000001000001100000110001001010000000101100000010100100001011010000001100000011000100011001000100000010010100001101000001110100001000011100010110100000100000101000010000000101000000100010010...
output:
693151164353298294991771915092246165588784011427723401514863569537180974110856679276502848848450095232556023520581621103706505329485541531644093395334224709813099430572342689943389061768308122334167396889122558885489842353859845505679740760989001467096316722773918455965593584892515339969002792035902...
result:
ok 20 tokens
Test #32:
score: 0
Accepted
time: 81ms
memory: 3548kb
input:
100000 19 11010101011011001011010111100000010010101100101010111000101110101001010110011011010011100100011110010011010011110111000100110000001111110010101000011111010011011101001100000000101011110100100100101100101010101100110111010011000101110111010110101000010110001010111110001010110100110000001111...
output:
171664461199134562766995650684440673085489422465326109270356812483138547934706911599756894207664574188038519627617045518815980608296136814038903827336872029429200125283024307872759381900102481215772231730929597377309317705827303189555946879704202361491952110134028530508207284059394040436511100411837...
result:
ok 19 tokens
Test #33:
score: 0
Accepted
time: 13ms
memory: 3540kb
input:
90139 20 101101100100111111111011100111110110111001111101101101110111011101011100111110111010110111101110110111101011011101100111110111011011101101110111101011011101101110101111101011101100111110101111011101101110110101111001111101101110110011111011101110110110111001101111101110011111011011101101110...
output:
114295361082305127942208281911086652195193612036965258194540554839765604416562780276165239338044991656166078586296137971810820270121979910956362520343058615413830387682572956846149751679906531190159869196033901257029539803703475752647797700268137583373220831250186514085304302366054423749897416545653...
result:
ok 20 tokens
Test #34:
score: 0
Accepted
time: 2ms
memory: 3468kb
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: 7ms
memory: 3584kb
input:
90139 20 101101100100111111111011100111110110111001111101101101110111011101011100111110111010110111101110110111101011011101100111110111011011101101110111101011011101101110101111101011101100111110101111011101101110110101111001111101101110110011111011101110110110111001101111101110011111011011101101110...
output:
114295361082305127942208281911086652195193612036965258194540554839765604416562780276165239338044991656166078586296137971810820270121979910956362520343058615413830387682572956846149751679906531190159869196033901257029539803703475752647797700268137583373220831250186514085304302366054423749897416545653...
result:
ok 20 tokens
Subtask #5:
score: 20
Accepted
Test #36:
score: 20
Accepted
time: 1198ms
memory: 3512kb
input:
98506 19 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
129925218195110981928395603118620127370928987146661525428495695586166441747122093986633381663949018340767091695255765965383300189018270134867014350559130786488843071697388697629880544282189724796656061147120839501796085974192680677594715705534842173371362779820511889417967125799617139889557622193947...
result:
ok 19 tokens
Test #37:
score: 0
Accepted
time: 1326ms
memory: 3576kb
input:
98107 20 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
527265839077857521497416198888919778846727355936516811052858653752779354239134035489585889673173570433976086063175478007735962137393225004688081932177960727699073098027172761184917657287594618913910720046026360754669451358305417371044109966942631377902865139837895253996769599308120231114825944134198...
result:
ok 20 tokens
Test #38:
score: 0
Accepted
time: 1657ms
memory: 3528kb
input:
90617 19 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
666374983524855186303039000471101770746042370225559504610884569211155956594786693001919362946025330481546492736967361260910321846469329901460557089032129738252728167645009739034587374605356179202121583720097923648747105121832320026231263470938810065066225476496390980891950613443111412134856355569103...
result:
ok 19 tokens
Test #39:
score: 0
Accepted
time: 1528ms
memory: 3584kb
input:
91638 20 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
749280237134299365180934332036030508673107342998133733598260817690853703056854175998470050167458026725069595860678760695673430964432581782087602168671040132576982518796026319976905928239793771119549343578028289260503526006598064984019418714113379557968154389880453328672708684070726356874273787688451...
result:
ok 20 tokens
Test #40:
score: 0
Accepted
time: 1048ms
memory: 3604kb
input:
95581 20 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
366171034663809468679459034395080062142191651595492759309996327220753710310479503269698114592077869066079697679494652125961394417698737871251961127691308226942371841498084459737601576416022412123791684816391712432854421673477265739566047600429615604006716416986389448500108542818255187286996841577195...
result:
ok 20 tokens
Subtask #6:
score: 18
Accepted
Dependency #2:
100%
Accepted
Test #41:
score: 18
Accepted
time: 6ms
memory: 3164kb
input:
190 19 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 2 3030536584264275991656446184192931032142342202853788773124469117132936126944321526393387980895665026...
output:
303053658426427599165644618419293103214234220285378877312446911713293612694432152639338798089566502665575779543814797512740930993972387315159956432349381665458354645284037027514891865835605478519158667178660184697604213917963871214214812993111821807966534988024828960583750304242594098806161798042315...
result:
ok 19 tokens
Test #42:
score: 0
Accepted
time: 3ms
memory: 3228kb
input:
193 19 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 1 1351772618151481423230177086652803238158508064486406797357216616385709633380157485598761110616759...
output:
135177261815148142323017708665280323815850806448640679735721661638570963338015748559876111061675986698273716658276773734390827561113116964538186189052478876635588737990551692498234494057058003059839751209829199035845447832974080800145478641135936706193078823264491086923999420322165582774203161595102...
result:
ok 19 tokens
Test #43:
score: 0
Accepted
time: 6ms
memory: 3232kb
input:
190 19 0000000011010110000100000000010000000000000000000100010000000000000000010100000111000001010000000011000001000000000000000000000000010010110101000011000000000000100000000000000000000000010010 1 7025546092138551598322506344609083764370337686180747350121879133435593878050481996018963226269128116...
output:
121066315045921793195200592070648049655182238067889414547155845804375798542180628895704193688487901135863687255971248858541143901463046375455959397730944384192574836173285774465365427926461293985125013936864584936350168615280937114979940883153218796189556449143484390864297448295233235970026936487842...
result:
ok 19 tokens
Test #44:
score: 0
Accepted
time: 1ms
memory: 3076kb
input:
192 20 110000000000000000011000010000110111001100000010100010001001101110000100100011001011000001000000001001001001010000000100010000100010000000000010010111000000000000001000001110100100110001100100 2 51479842325970730010319087287497995149596274445858463282007641826381091860094358712133023804622138...
output:
inf 38341998613194711610851598392376329213398429862236791722758429828646326206870946489490519963026620278136704108955473770401179989284259951741936057704130095473505373978595010127371825804565979665889636708149937481617973071629996787507036030381953952077912690620515217533760857971046867181877030987...
result:
ok 20 tokens
Test #45:
score: 0
Accepted
time: 4ms
memory: 3080kb
input:
196 20 0000001000111101011010100011000010000101011011110010010001001000100111000101100101001111001010010011000100000111110110001101001010100000101101110100100000001000011101111101010000100111011000101011 1 5015320864439209304113353314551060919088155080394686712838786263814988191390498501749844810680...
output:
983002889430085023606217249652007940141278395757358595716402107707737685512537706342969582893376081409407560680631350221655106602096322436309682564428967871040525844907753791470991421295721108784719338314023419167873478652184575613811169808572719480004991417722134184854576650304466492357556422463891...
result:
ok 20 tokens
Test #46:
score: 0
Accepted
time: 7ms
memory: 3080kb
input:
194 20 11011011110101101111101100110110101101111111011000111110111101111111111110101101111100111000100101111111100101011100110100011001010110011111101011110101111101011101010111001010011100100011101010 1 841496047844694106271899368968881221632199488715438957442647728849671943144930052559312457648223...
output:
891504250247790381112709236090289423357957492080039511773428701730686930228377839982132933854757846565323633322867282290995678030292425283974968227167227130246366960144042655498999943869557004317637813542338734912429234258824024567967120930328757422981159724306506145045239740956838608794789118224561...
result:
ok 20 tokens
Test #47:
score: 0
Accepted
time: 4ms
memory: 3084kb
input:
198 19 100110000110000111000000110000110010010100100011000000100110100010011110000000000100101100010011100000001000110100100000101000100100111010010000001000101000101001000100100100100110001000100101001000 2 35268317002431184701422245442405829000005923579945992741874795798460235954723010375715676030...
output:
188097690679632985074251975692831088000031592426378627956665577591787925091856055337150272161223232461075499593059212126413825718672976251812558867468696130695110574802879014919091206063605134554089047800467112022986558512528893907722423493493816444748847965076074729184451781829746238206659222584006...
result:
ok 19 tokens
Test #48:
score: 0
Accepted
time: 4ms
memory: 3120kb
input:
199 20 1000100010001000110000000010100010001000100010001000100010000100110000001000100010001000100010001100000010001000101000001000110000001000100010001000100001001000100010001000100010000010100100001000010 2 9920712460050181008040669786206611702734689138566783308194618736710864209338567704897309905...
output:
137780749052581345532524628751902126097653251792532398834285816751681663108339027610100202261210293919458371492650808877579565823149430999460191591192171578233591292569082476673858256583027045372506280728359601893043627060360779272172294102411578650200602856181121172884178186372659597881229494321504...
result:
ok 20 tokens
Test #49:
score: 0
Accepted
time: 6ms
memory: 3148kb
input:
191 20 10111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111 2 708525660737406064209605877955610699402495358097794658985099436654795878211525631427013176482016048...
output:
inf inf 4764927063424643385341316766894784077864447120347285019511038095835913836667468759882261308236894726769820585012982456865154319735565724505528756774276804286509553413096771267207786515671233882308497257886626356998534713361777345209974300706236027393518835957128358317338182290033572959471779...
result:
ok 20 tokens
Test #50:
score: 0
Accepted
time: 8ms
memory: 3152kb
input:
196 20 0101010100101010000110101010010101001010101001010100011001010111000010100110100010101001010010101010010100101010001101001001101010010001100110010110001010100101010010100101010010101001001101000110 1 3551825666225435715140441769407013363202718798956997020423487134473591163156979354572547081663...
output:
106690855261331095811115185717053581484710020627673780230345360667712470188316927738884172874481020065642522790344535637340588417934807971310354266142919040154634601403517324924829231747161526173417648078520507237523392804966603166147332292447888965648407387232298106862685661916582343133108491410284...
result:
ok 20 tokens
Subtask #7:
score: 30
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Test #51:
score: 30
Accepted
time: 8ms
memory: 3600kb
input:
94207 20 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
476456711349029375038479267033522857344945027950501265294346347872334464006306981709193302320659830946407694012925748575195449494671122484946828909314976751027478129491921859992001992614183444101948610784461086268599677820460977789904555932779914984662354687178647062139125844679249652778024469198966...
result:
ok 20 tokens
Test #52:
score: 0
Accepted
time: 4ms
memory: 3540kb
input:
96572 20 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
481585723906747258534015518062527842107045428608616736157667967082203660700789404805447976133174508526764474415852804034753789806659771747370490016076740154825710733978953299629499301913103035132720006475185637903996768591440285672770429939695585485714358533541240401908414076860940249080281579932942...
result:
ok 20 tokens
Test #53:
score: 0
Accepted
time: 1114ms
memory: 3528kb
input:
94235 20 011111011101100010110111011111011111111011110111111000100101111011011111111110111001111010111101111110111011000001101110101110111111111111101101111001100100010110001100011011100010101101101111001001101101011001001011011011001001000101110011010111111111110011111000111100110111100111110000100...
output:
863844614696172674639936108684456054476622022692818999830909464430354779295444230896388457032445504586706623231372778855642468032638317542594725105272555775198549013807242574876072530411857433357953801340371450778973399331604974314412220117128994030995016398151329880243644480376356274526910258238883...
result:
ok 20 tokens
Test #54:
score: 0
Accepted
time: 1503ms
memory: 3552kb
input:
99180 20 111111111111111111111111111111111111011111111111111111111111111111111111011111111111111111111111101111111111111111111111111101101111111111111111111111111111111111111111111101111111111111111111111111111111111110111111111111111111111111111111111111111111111101111111111111111111111111111111111...
output:
110669786763149948712772011297683013358972217650067513164152747161007548377873284127789323376694849469412495782546683848092089675557738167277050722091250179087748199344907433015036763806393412168368826127597444179927141829471289469428181017911706084132842996629718115847488114839878611223572575211665...
result:
ok 20 tokens
Test #55:
score: 0
Accepted
time: 3ms
memory: 3520kb
input:
94249 19 001110110110011110100111101011100111101001100011101111010111100101110011110110110110001011000101110000001101001101111111100100111101111101111110111011010110000101011001101011011010101111011011001101101101010100010011101111001001011001100011000111001101010110111111111111110111101100011111011...
output:
inf 77199215091072631639182041924732627972086803940428121973968371483893037474075337460452123580065900240875545843196701340884732459928345935467239951620243211330096205705444603397231114687422727107710746807091684043378797273854710428344627505416199339261058136595609100281194165388580514219526515342...
result:
ok 19 tokens
Test #56:
score: 0
Accepted
time: 1932ms
memory: 3568kb
input:
97438 19 100100000101000101000100000001100000100000010100100010101100100000000100011100100101100001010000000000000000001001010110010000010001000001010000111001000010010000010000000000000000000000000000010010101000010000011000000110010100110011100000110110000100010000011000010000001100001000010010000...
output:
732142436670386834625809707040529756255043627723538946757680111042823301491964248359628323583240047844972509211774992191208514713161130042825235157036881615542102035758145409603212120613546310398172720201608632918542710972906731045641286446739292438796548115752925668558205927964547290906567004375359...
result:
ok 19 tokens
Test #57:
score: 0
Accepted
time: 958ms
memory: 3604kb
input:
99994 19 111111100111011111110110111111101111111110111010111111111111111111111011111011111111111111001111011111111100010011111100111101011111111110101111000111010011101011111011101101100011110001111001101011110111101111111111101111111101011110010111111111101001111111110111101001110110110111101101111...
output:
190478324430469407063043053149316094950598264625649153072765355458080632860340193672866229937593943844533220526892466952969800666641899638136267777599967331272400812247676118898806569355872500112103137871022595001547119795574551883712240934687797310505287520542426595878269247439996923838058650688474...
result:
ok 19 tokens
Test #58:
score: 0
Accepted
time: 801ms
memory: 3584kb
input:
92264 20 011010101101011001110101011001101101011010101101011010110101010110101110010110101101010110101011010110011001110110101011010110101011000111011011010110101010101101111000110101110010101101011010110101011010110101011010100111011010101101011010101001110110011110001110101101001110101011010111001...
output:
142803782147997521662356165844881622617502954934535561817811919631463275774182435321644488977773242614007803482729038412114674333931420697550622993314873946245560376604519892258089984975814453352226247671792722267706550987372558791921769786045667604475244864118929402668076664553246677284634218750638...
result:
ok 20 tokens
Test #59:
score: 0
Accepted
time: 549ms
memory: 3504kb
input:
90761 20 101011011010011101110011010111101001101101011010110101101101011010110110101101011011001110110101101000111110110100111101011010011101101101011001110111001101011011010110101101101011000111110100111011101010011101101101011001110110101101011011010110011101101001110110110101101011101100111001101...
output:
inf inf 1145975917377911433218814770869642587051779150891250325980308105266378645029663313632166366475945269128452625453650675296544468003398987454207725000860745897633174072153574649782158481550395677097738803025904091402580481593632302590123464421326574862910241675148077338711546121775594338270987...
result:
ok 20 tokens
Test #60:
score: 0
Accepted
time: 558ms
memory: 3704kb
input:
99997 20 011011011001110101010111101101010111010110110110101110101101011011010110110110101101011011011010110001100111111101101001111010110110101101101011011011010110110110011101101011101011010110110101101101101011101011010110110101101101101001111010101110101101101101011011010110110110101101101101011...
output:
331360775783561868915400562201570242403153193279308609855473890099697496893957142557533053127562357768124088062336853044343777780940049716596600429452104989025022025262604219651805228882241770398733649302842747594078955608207123232760034170077625800405575222202983603543475324615267314251430008813073...
result:
ok 20 tokens
Test #61:
score: 0
Accepted
time: 9ms
memory: 3544kb
input:
91340 19 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
133692881975280866746115556914722609355742165913782845466968528198202010701859733459669332725177995160656913973946892688754655990210457360054808090944991983031152396833959424207447432001082572967015464027831364926600665370801825073165307492357785863569917347099270702700437233535694623669883338539213...
result:
ok 19 tokens
Test #62:
score: 0
Accepted
time: 6ms
memory: 3508kb
input:
90946 19 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
988377011807398263661566966338959778371459165174569460554543369120459761030361009324869937417587595953771012481107952522901289787457451678223047924484870380373145361574428406019154610069130426942767546705310007100490981434256389190111314062833275925633309009753918043172056079368283308133071958578782...
result:
ok 19 tokens
Test #63:
score: 0
Accepted
time: 1939ms
memory: 3516kb
input:
93886 20 000000100000000000000000000000000001010000000000001010000000000000010010000000000000001000000000010000000000101000000001000000000000000000000000000000000000000000000000000000000000000000000000000000001001100000000000000000000000000000000000000001000000000100010100000000000000000000101000000...
output:
144531581656498647539681180454685377116926981606893320667587019374123721598961858383814299490167878988519728767320628745897615130228614211428723215607620072292045400007433898231868517747631802315267565045651579220142556726245399941256376566406059273086775887418773289672623971487199819436779454078040...
result:
ok 20 tokens
Test #64:
score: 0
Accepted
time: 1572ms
memory: 3536kb
input:
92825 20 000000000000000000000000000000000000000000100000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000100000000000000000000000000000000000001000000000000000...
output:
389105316386435182144618709757481579319848224929941998716266164984750872680703765676367033008820214561693756671487383509303435234942742334499035442631506410125999025262246750753666342269367508526536461059973329535384726705097499688390486550181510673728793690564160083868257950172934514906325625287832...
result:
ok 20 tokens
Test #65:
score: 0
Accepted
time: 4ms
memory: 3524kb
input:
93760 20 000000000000000100000001000000000000001000000001000100000001000000000000100000000000000100010000000000100000000000000000000001100000000000000100100000000100000001000000000000000010000010000010000010000000000100000000010000000000000000000000000000010000001000000100000000001000000000000000000...
output:
924132377438138488500089431873990775871374541070316381247158819550768106604269218838451324735531284765561717911659037058761431041405253193086490782695154678383014577432140068247977971185671467565806164858868190219704925686332046281845270716704568819582517284786207985613137554539665303034183127479345...
result:
ok 20 tokens
Test #66:
score: 0
Accepted
time: 2570ms
memory: 3536kb
input:
97505 19 111111111111111110011111011111010111011111111101111110101111110111111111111111111001110111111101111111101111111101011111111111111001111111111011111111110111111011111011111111111111110111111011101111110111111101111111100100111011110011011111111111111011111111111111111011110111110111111111111...
output:
568281279949373270771065107861504172853487482239621564630464187285300247809607996113248488788593763648979360523033431535230545967988341174926872145575813406245944384747221311212633050320669523467790580681022857369507571978474902654978871088341295708853384993829177253384643227523382150251097121370489...
result:
ok 19 tokens
Test #67:
score: 0
Accepted
time: 2781ms
memory: 3640kb
input:
100000 20 11111111111111111110011111111111101111111111111111111111111111111111101111111111111001110111111111111111111111111111111111111111111111110110111111111111111110111110111111111111111111101110011111111111101111110101111111111111111110111111100111101011011111111111111111101111111111111111111111...
output:
114796390993688479076310281299158402419506588380552411875975782347517555015245595065922144251854726685042544148117072058332589874942501043594109398221511978538761949316991525758658342201516224347103534548108876423790963654846062991915192417402533334059755725906303443778805877923537966358750883358318...
result:
ok 20 tokens
Test #68:
score: 0
Accepted
time: 1234ms
memory: 3592kb
input:
94457 20 101010110101011010110100111010110011011010110101011010110101101110010101010110110110011010110110101010110101011010110101011010111001011010110101011010101011010110101101001110101101011010011101011010110011011110001101011010101100110110110011101010101101010110101101001101101101011010101101011...
output:
837104199867090685080434664508520821938905373035452675818163527396527572383890532986781853113447830617980707513758094659386775143275448467396802038133083011615849761820350923089358581285718254469721464950324472483840543971562312971891757602732049936279436831077174236626475575986377741954615824987012...
result:
ok 20 tokens
Test #69:
score: 0
Accepted
time: 2427ms
memory: 3704kb
input:
98293 19 100000000000000100000000000001000000000000010000000000000100000000000000100000000000010000000000000100000000000001000000000000001000000000000100000000010000000000000000010000000000000100000010000000000000000000010000000000000100000000000000100000000000010000000000000010000000000001000000000...
output:
994647935794197520604112860675977138436965475112307881154820751319086422154177291891846016406958935661441877515797545528054459520774870218305062615241236795142235941834464319293372785915677335484658649484238424810560869433741620305833294698692638658053466447642716114004853895072808548334223802149604...
result:
ok 19 tokens
Test #70:
score: 0
Accepted
time: 1190ms
memory: 3544kb
input:
99996 20 101001110101101100110110011010110101101010010111100110110100111010111001011001110101101010111001101010110101100111010101101011010101011010110101011010110101011010110101110010110100010111110101100110100011011111010011011010111001101010110101101010111010011010110101011010110101011100110101101...
output:
358825839499221920373103543354619201538850864256252620906738041710584547099532456276589231329797776094090161080651394329186497014729165360053945955415891660441082820888019893338966088584861566795246178903882608112991630832510533661632087387781493718963927566631201533293528002826709215300772564431162...
result:
ok 20 tokens