QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#811377 | #9812. Binary Search | kkkgjyismine4 | AC ✓ | 406ms | 115356kb | C++20 | 1.7kb | 2024-12-12 18:49:31 | 2024-12-12 18:49:32 |
Judging History
answer
#include<bits/stdc++.h>
#define N 300005
#define pb push_back
using namespace std;
char str[N],t[10];
int id[N][4],tt,n,m;
vector<int>rd[N],Rd[N*4],Rd1[N*4];
int vis[N*4],len[N*4],dg[N*4];
const int inf=1e9;
void Add(int u,int v){Rd[u].pb(v);}
void dfs(int u){
vis[u]=1;
for(int v:Rd[u])if(!vis[v])dfs(v);
}
queue<int>q;
int calc(){
tt=0;
for(int i=1;i<=n;++i)
for(int j=0;j<4;++j){
if(t[j]==str[i])id[i][j]=++tt;
else id[i][j]=0;
}
for(int i=1;i<=tt;++i)Rd[i].clear(),Rd1[i].clear(),dg[i]=len[i]=vis[i]=0;
for(int i=1;i<=n;++i)
for(int v:rd[i])
for(int j=0;j<4;++j)
if(id[i][j]&&id[v][(j+1)%4])
Add(id[i][j],id[v][(j+1)%4]);
for(int i=1;i<=n;++i)
if(id[i][0]&&!vis[id[i][0]])dfs(id[i][0]);
for(int i=1;i<=tt;++i){
if(!vis[i])continue;
for(int v:Rd[i])if(vis[v])Rd1[i].pb(v),++dg[v];
}
while(q.size())q.pop();
for(int i=1;i<=n;++i)
if(id[i][0]&&!dg[id[i][0]])q.push(id[i][0]),len[id[i][0]]=1;
while(q.size()){
int u=q.front();q.pop();
for(int v:Rd1[u]){
--dg[v];
if(!dg[v])len[v]=len[u]+1,q.push(v);
}
}
for(int i=1;i<=tt;++i)if(vis[i]&&dg[i])return inf;
int mx=0;
for(int i=1;i<=tt;++i)if(vis[i])mx=max(mx,len[i]);
return mx;
}
int val[N];
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;++i)scanf("%d",&val[i]),str[i]=(char)(val[i]+'0');
for(int i=1,u,v;i<=m;++i)scanf("%d%d",&u,&v),rd[u].pb(v),rd[v].pb(u);
t[0]=t[3]='0',t[1]=t[2]='1';int ans=calc();
// cout<<ans<<endl;
t[0]=t[3]='1',t[1]=t[2]='0';ans=min(ans,calc());
// cout<<ans<<endl;
t[0]=t[1]='0',t[2]=t[3]='1',ans=min(ans,calc());
// cout<<ans<<endl;
t[0]=t[1]='1',t[2]=t[3]='0',ans=min(ans,calc());
if(ans<=1e7)cout<<ans+1;
else puts("infinity");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 12132kb
input:
4 4 0 0 1 1 1 2 1 3 2 3 3 4
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 4ms
memory: 12164kb
input:
6 7 0 0 1 1 0 1 1 2 3 1 1 4 2 3 4 2 3 4 5 6
output:
infinity
result:
ok single line: 'infinity'
Test #3:
score: 0
Accepted
time: 4ms
memory: 12152kb
input:
1 0 0
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 4ms
memory: 11792kb
input:
1 0 1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 4ms
memory: 9752kb
input:
2 0 1 1
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 4ms
memory: 11928kb
input:
2 0 1 0
output:
2
result:
ok single line: '2'
Test #7:
score: 0
Accepted
time: 4ms
memory: 12112kb
input:
2 1 0 0 1 2
output:
1
result:
ok single line: '1'
Test #8:
score: 0
Accepted
time: 4ms
memory: 9772kb
input:
2 1 0 1 2 1
output:
2
result:
ok single line: '2'
Test #9:
score: 0
Accepted
time: 0ms
memory: 12136kb
input:
3 2 0 1 1 1 2 2 3
output:
2
result:
ok single line: '2'
Test #10:
score: 0
Accepted
time: 0ms
memory: 12160kb
input:
3 2 0 0 0 1 2 2 3
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 0ms
memory: 11812kb
input:
3 3 0 0 0 1 2 2 3 3 1
output:
1
result:
ok single line: '1'
Test #12:
score: 0
Accepted
time: 0ms
memory: 11944kb
input:
3 3 0 0 1 1 2 2 3 3 1
output:
2
result:
ok single line: '2'
Test #13:
score: 0
Accepted
time: 4ms
memory: 11936kb
input:
4 3 0 0 1 1 1 2 2 3 3 4
output:
4
result:
ok single line: '4'
Test #14:
score: 0
Accepted
time: 4ms
memory: 11872kb
input:
4 4 0 1 1 0 1 2 2 3 3 4 4 1
output:
infinity
result:
ok single line: 'infinity'
Test #15:
score: 0
Accepted
time: 4ms
memory: 11848kb
input:
4 4 0 1 0 1 1 2 2 3 3 4 4 1
output:
2
result:
ok single line: '2'
Test #16:
score: 0
Accepted
time: 2ms
memory: 9824kb
input:
3 1 0 0 1 1 2
output:
2
result:
ok single line: '2'
Test #17:
score: 0
Accepted
time: 4ms
memory: 12168kb
input:
3 1 1 0 1 1 3
output:
2
result:
ok single line: '2'
Test #18:
score: 0
Accepted
time: 0ms
memory: 12172kb
input:
3 1 0 1 1 1 2
output:
2
result:
ok single line: '2'
Test #19:
score: 0
Accepted
time: 4ms
memory: 10120kb
input:
4 2 0 0 1 1 1 2 3 4
output:
2
result:
ok single line: '2'
Test #20:
score: 0
Accepted
time: 4ms
memory: 11840kb
input:
6 3 0 0 1 1 0 1 1 2 3 4 5 6
output:
3
result:
ok single line: '3'
Test #21:
score: 0
Accepted
time: 4ms
memory: 11872kb
input:
6 6 0 0 1 1 1 0 1 2 2 3 3 1 4 5 5 6 6 4
output:
4
result:
ok single line: '4'
Test #22:
score: 0
Accepted
time: 0ms
memory: 9900kb
input:
6 6 0 0 0 1 1 1 1 2 2 3 3 1 4 5 5 6 6 4
output:
2
result:
ok single line: '2'
Test #23:
score: 0
Accepted
time: 0ms
memory: 10088kb
input:
3 2 1 0 0 1 2 3 2
output:
2
result:
ok single line: '2'
Test #24:
score: 0
Accepted
time: 4ms
memory: 11872kb
input:
7 10 1 0 1 1 0 0 0 2 4 4 5 5 6 7 2 5 3 3 2 1 3 6 2 7 5 3 7
output:
4
result:
ok single line: '4'
Test #25:
score: 0
Accepted
time: 4ms
memory: 12164kb
input:
4 6 0 1 1 1 2 3 3 4 1 4 2 4 3 1 1 2
output:
2
result:
ok single line: '2'
Test #26:
score: 0
Accepted
time: 4ms
memory: 12132kb
input:
3 1 0 1 1 1 3
output:
2
result:
ok single line: '2'
Test #27:
score: 0
Accepted
time: 4ms
memory: 11944kb
input:
7 18 0 0 0 0 1 1 0 4 2 7 1 2 3 7 2 6 5 4 1 5 7 6 3 6 1 6 7 4 7 5 1 5 3 4 5 3 7 4 6 2 1 2 5
output:
infinity
result:
ok single line: 'infinity'
Test #28:
score: 0
Accepted
time: 4ms
memory: 9828kb
input:
7 17 1 0 1 0 0 0 0 6 3 5 1 6 4 7 6 7 2 3 1 6 1 2 4 1 2 4 7 7 1 3 2 5 2 4 5 5 7 3 7 3 4
output:
infinity
result:
ok single line: 'infinity'
Test #29:
score: 0
Accepted
time: 2ms
memory: 11944kb
input:
5 9 1 1 0 0 0 2 3 5 3 3 4 4 2 1 2 5 1 5 4 1 4 5 2
output:
infinity
result:
ok single line: 'infinity'
Test #30:
score: 0
Accepted
time: 2ms
memory: 11892kb
input:
8 14 1 0 0 0 1 1 1 0 2 4 8 4 2 1 5 6 8 1 3 7 7 5 7 4 3 4 1 5 2 3 8 3 5 3 7 2
output:
infinity
result:
ok single line: 'infinity'
Test #31:
score: 0
Accepted
time: 4ms
memory: 9844kb
input:
10 17 1 0 1 1 0 0 1 1 1 1 4 9 7 5 9 3 1 5 3 6 1 9 10 2 3 5 8 4 6 10 6 8 9 8 9 6 2 7 5 10 3 4 1 3
output:
2
result:
ok single line: '2'
Test #32:
score: 0
Accepted
time: 0ms
memory: 11872kb
input:
8 17 0 0 1 0 1 0 0 1 1 4 7 8 8 5 1 7 1 2 8 4 6 1 5 6 8 2 6 4 5 3 5 4 6 7 1 5 2 3 6 8 7 2
output:
infinity
result:
ok single line: 'infinity'
Test #33:
score: 0
Accepted
time: 0ms
memory: 11808kb
input:
4 3 0 0 1 0 1 4 3 4 2 1
output:
2
result:
ok single line: '2'
Test #34:
score: 0
Accepted
time: 4ms
memory: 11868kb
input:
2 1 1 0 1 2
output:
2
result:
ok single line: '2'
Test #35:
score: 0
Accepted
time: 4ms
memory: 11844kb
input:
4 5 1 1 0 0 4 3 1 2 4 2 1 4 2 3
output:
infinity
result:
ok single line: 'infinity'
Test #36:
score: 0
Accepted
time: 4ms
memory: 11812kb
input:
7 20 0 1 0 1 1 1 0 7 5 2 7 2 1 1 4 5 3 2 3 4 5 1 7 6 4 4 3 6 7 2 6 3 1 7 3 4 2 7 4 3 6 1 6 5 6 5 1
output:
infinity
result:
ok single line: 'infinity'
Test #37:
score: 0
Accepted
time: 4ms
memory: 11872kb
input:
2 1 1 0 2 1
output:
2
result:
ok single line: '2'
Test #38:
score: 0
Accepted
time: 4ms
memory: 11868kb
input:
7 7 1 1 1 1 0 1 1 1 6 7 5 2 4 3 6 4 5 6 4 1 4
output:
2
result:
ok single line: '2'
Test #39:
score: 0
Accepted
time: 0ms
memory: 9824kb
input:
2 1 0 0 2 1
output:
1
result:
ok single line: '1'
Test #40:
score: 0
Accepted
time: 4ms
memory: 11872kb
input:
9 14 0 1 1 1 0 1 0 0 0 6 4 6 2 9 4 8 7 5 9 3 9 3 7 7 9 1 4 3 2 1 6 3 1 3 4 2 8
output:
infinity
result:
ok single line: 'infinity'
Test #41:
score: 0
Accepted
time: 4ms
memory: 11844kb
input:
9 3 0 1 1 1 1 1 1 1 0 1 7 1 8 9 8
output:
2
result:
ok single line: '2'
Test #42:
score: 0
Accepted
time: 4ms
memory: 11888kb
input:
5 9 1 1 1 1 1 3 4 1 5 3 2 2 5 3 5 2 4 1 3 1 2 4 1
output:
1
result:
ok single line: '1'
Test #43:
score: 0
Accepted
time: 15ms
memory: 20672kb
input:
95705 24453 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
2
result:
ok single line: '2'
Test #44:
score: 0
Accepted
time: 174ms
memory: 108816kb
input:
300000 299999 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 ...
output:
300000
result:
ok single line: '300000'
Test #45:
score: 0
Accepted
time: 5ms
memory: 10316kb
input:
2048 1792 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 ...
output:
9
result:
ok single line: '9'
Test #46:
score: 0
Accepted
time: 58ms
memory: 43860kb
input:
106496 98304 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0...
output:
14
result:
ok single line: '14'
Test #47:
score: 0
Accepted
time: 88ms
memory: 56768kb
input:
273145 11968 0 1 0 0 1 1 1 1 0 1 0 0 0 1 1 1 0 0 0 1 0 0 1 1 1 0 1 1 0 1 1 0 0 0 0 1 0 1 0 1 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 1 1 0 1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 1 1 1 1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 1 1 0...
output:
6
result:
ok single line: '6'
Test #48:
score: 0
Accepted
time: 125ms
memory: 40228kb
input:
96703 114215 1 1 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 0 1 1 1 0 0 1 0 1 0 1 0 0 0 1 1 0 1 1 0 1 0 1 0 0 0 1 0 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 1 1 1...
output:
infinity
result:
ok single line: 'infinity'
Test #49:
score: 0
Accepted
time: 48ms
memory: 32444kb
input:
130444 7653 1 1 0 0 0 1 1 1 1 1 0 1 1 0 0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 0 1 1 0 1 1 0 1 ...
output:
5
result:
ok single line: '5'
Test #50:
score: 0
Accepted
time: 158ms
memory: 66932kb
input:
279662 64342 1 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 1 0 1 0 1 1 0 0 0 0 1 1 1 1 0 1 0 0 1 0 1 1 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 1 1 1 1 0 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 0 1 0 1 0 0 0 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1...
output:
10
result:
ok single line: '10'
Test #51:
score: 0
Accepted
time: 140ms
memory: 51948kb
input:
166558 95631 1 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 0 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 0 0 0 1 0 0 0 1 1 1 0 0 1 1 1 1 1 1 0 1 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0 1 0 0 0 0...
output:
infinity
result:
ok single line: 'infinity'
Test #52:
score: 0
Accepted
time: 204ms
memory: 69236kb
input:
256680 102429 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 1 1 1 0 0 1 0 0 1 1 0 0 0 1 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 0 0 1 1 0 0 0 1 0 1 1 1 0 ...
output:
24
result:
ok single line: '24'
Test #53:
score: 0
Accepted
time: 118ms
memory: 61076kb
input:
250091 51839 0 1 1 1 1 0 1 0 0 0 0 1 0 0 1 1 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 0 0 0 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1 0 1 1 1 1 0 1 0 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 0 0 1 0 1...
output:
10
result:
ok single line: '10'
Test #54:
score: 0
Accepted
time: 39ms
memory: 19888kb
input:
21773 75044 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 ...
output:
infinity
result:
ok single line: 'infinity'
Test #55:
score: 0
Accepted
time: 95ms
memory: 54056kb
input:
222740 30482 1 0 1 1 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 0 0 0 1 1 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 1 0 1 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 1 1 0...
output:
8
result:
ok single line: '8'
Test #56:
score: 0
Accepted
time: 202ms
memory: 72424kb
input:
269062 115503 0 1 0 0 1 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 1 0 0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 ...
output:
infinity
result:
ok single line: 'infinity'
Test #57:
score: 0
Accepted
time: 4ms
memory: 12116kb
input:
25 1 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 1 10 25
output:
2
result:
ok single line: '2'
Test #58:
score: 0
Accepted
time: 0ms
memory: 11812kb
input:
25 60 0 1 1 0 0 1 1 1 0 1 0 1 1 1 0 0 0 1 1 1 0 0 0 0 0 13 19 5 19 16 19 24 25 6 18 1 12 14 17 20 24 4 14 14 22 23 24 19 25 13 24 6 20 2 7 5 17 6 9 13 23 15 17 21 23 5 15 10 17 19 21 20 22 7 11 9 10 23 25 7 19 12 19 3 11 6 12 8 15 9 19 18 25 10 25 5 6 14 19 16 20 12 15 14 15 7 10 1 8 20 23 8 14 10 2...
output:
infinity
result:
ok single line: 'infinity'
Test #59:
score: 0
Accepted
time: 77ms
memory: 57028kb
input:
300000 7000 0 0 0 0 0 1 1 1 0 1 0 0 1 1 0 0 1 1 0 0 1 0 1 1 1 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 1 0 1 0 0 1 1 0 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 1 1 1 0 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 0 0 1 0 1 1 1 1 1 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0 ...
output:
5
result:
ok single line: '5'
Test #60:
score: 0
Accepted
time: 189ms
memory: 74608kb
input:
300000 81769 1 0 1 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 1 1 0 1 1 0 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 0 1 0 1 0 1 1 0 0 0 0 1 1 0 0 0 1 1 0 1 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0 0 1 0 1 0 1 0 0 0 0 0 1 1 0 0 1 1 0 1 1 0 1 0 0 1...
output:
14
result:
ok single line: '14'
Test #61:
score: 0
Accepted
time: 213ms
memory: 75948kb
input:
300000 100248 1 1 0 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 1 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 1 0 0 0 0 1 0 1 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 ...
output:
16
result:
ok single line: '16'
Test #62:
score: 0
Accepted
time: 99ms
memory: 62000kb
input:
300000 12580 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 0 1 0 1 1 1 1 0 0 0 1 1 1 0 0 1 1 1 0 1 1 1 0 1 0 0 0 1 1 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 1 1 0 1 1 1 0 0 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 0 1 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 0 0...
output:
6
result:
ok single line: '6'
Test #63:
score: 0
Accepted
time: 188ms
memory: 73740kb
input:
300000 89146 0 1 1 1 0 0 1 0 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1 1 0 1 0 1 1 0 1 0 0 1 0 0 1 0 0 0 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 0 1 0 1 0 1 0 0 0 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1...
output:
14
result:
ok single line: '14'
Test #64:
score: 0
Accepted
time: 107ms
memory: 62516kb
input:
300000 21077 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 1 1 1 0 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0...
output:
6
result:
ok single line: '6'
Test #65:
score: 0
Accepted
time: 69ms
memory: 53532kb
input:
300000 4407 1 1 1 1 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 0 1 0 0 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 1 0 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 ...
output:
4
result:
ok single line: '4'
Test #66:
score: 0
Accepted
time: 262ms
memory: 82240kb
input:
300000 145683 0 0 0 1 0 1 1 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1 1 1 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1 1 0 0 1 0 0 0 1 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 ...
output:
26
result:
ok single line: '26'
Test #67:
score: 0
Accepted
time: 104ms
memory: 64296kb
input:
300000 28900 0 1 0 0 0 1 0 1 1 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 1 1 0 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 0 1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1 1 0 1 0 0 0...
output:
7
result:
ok single line: '7'
Test #68:
score: 0
Accepted
time: 154ms
memory: 71492kb
input:
300000 57744 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 0 0 0 0 1 1 1 1 0 1 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 1 0 1 0 1 0 1 1 1 0 1 0 0 1 1 0 0 0 0 0 0 1 0 1 0 0 1 1 1 1 0 0 1 0 1 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 0 0 1...
output:
9
result:
ok single line: '9'
Test #69:
score: 0
Accepted
time: 18ms
memory: 17468kb
input:
19911 38407 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1
result:
ok single line: '1'
Test #70:
score: 0
Accepted
time: 49ms
memory: 29288kb
input:
63456 123463 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
1
result:
ok single line: '1'
Test #71:
score: 0
Accepted
time: 146ms
memory: 42272kb
input:
101483 122403 0 0 1 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 1 0 1 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 1 1 1 0 1 0 1 0 0 0 0 0 1 0 1 1 1 0 0 0 1 0 0 0 0 1 1 0 1 1 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 1 1 1 1 ...
output:
infinity
result:
ok single line: 'infinity'
Test #72:
score: 0
Accepted
time: 148ms
memory: 57060kb
input:
195063 93971 0 1 1 0 0 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 1 1 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 1 0 1 1 1 1 0 0 1 1 0 1 0 0 0 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 0 1...
output:
infinity
result:
ok single line: 'infinity'
Test #73:
score: 0
Accepted
time: 109ms
memory: 54308kb
input:
174499 69645 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 1 1 0 0 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 0 1 0 0 1 1 1 1 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 1...
output:
infinity
result:
ok single line: 'infinity'
Test #74:
score: 0
Accepted
time: 76ms
memory: 52712kb
input:
211658 34499 0 1 0 1 1 0 1 0 0 1 1 0 1 1 0 1 0 1 0 1 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 1 1 1 0 1 0 1 0 0 1 1 0 1 1 1 0 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 0 1 0 1 0 1 1 0 0 0 0 1 1 1 1 0 0 1 0 0...
output:
infinity
result:
ok single line: 'infinity'
Test #75:
score: 0
Accepted
time: 24ms
memory: 20352kb
input:
42818 14825 1 1 1 1 0 0 1 1 1 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 1 1 0 1 1 0 0 0 0 1 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 1 0 1 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 0 0 1 1 0 0 0 1 1 1 1 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 1 1 ...
output:
infinity
result:
ok single line: 'infinity'
Test #76:
score: 0
Accepted
time: 134ms
memory: 73208kb
input:
300000 79833 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 1 0 1 1 1 1 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 1 1 0 1 1 1 1 0 0 1 0 1 0 1 1...
output:
2
result:
ok single line: '2'
Test #77:
score: 0
Accepted
time: 0ms
memory: 12500kb
input:
500 12500 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ...
output:
2
result:
ok single line: '2'
Test #78:
score: 0
Accepted
time: 3ms
memory: 12560kb
input:
500 12500 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ...
output:
infinity
result:
ok single line: 'infinity'
Test #79:
score: 0
Accepted
time: 8ms
memory: 12504kb
input:
500 12500 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ...
output:
infinity
result:
ok single line: 'infinity'
Test #80:
score: 0
Accepted
time: 6ms
memory: 12476kb
input:
500 12500 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ...
output:
4
result:
ok single line: '4'
Test #81:
score: 0
Accepted
time: 6ms
memory: 12516kb
input:
500 12500 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ...
output:
infinity
result:
ok single line: 'infinity'
Test #82:
score: 0
Accepted
time: 4ms
memory: 11948kb
input:
38 37 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38
output:
36
result:
ok single line: '36'
Test #83:
score: 0
Accepted
time: 0ms
memory: 10128kb
input:
38 37 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38
output:
34
result:
ok single line: '34'
Test #84:
score: 0
Accepted
time: 0ms
memory: 11916kb
input:
38 37 0 1 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38
output:
32
result:
ok single line: '32'
Test #85:
score: 0
Accepted
time: 4ms
memory: 11828kb
input:
40 40 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 ...
output:
infinity
result:
ok single line: 'infinity'
Test #86:
score: 0
Accepted
time: 4ms
memory: 11908kb
input:
14 14 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 1 14
output:
12
result:
ok single line: '12'
Test #87:
score: 0
Accepted
time: 0ms
memory: 9784kb
input:
40 40 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 ...
output:
30
result:
ok single line: '30'
Test #88:
score: 0
Accepted
time: 197ms
memory: 108416kb
input:
300000 300000 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 ...
output:
599996
result:
ok single line: '599996'
Test #89:
score: 0
Accepted
time: 160ms
memory: 115356kb
input:
299998 299999 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 ...
output:
infinity
result:
ok single line: 'infinity'
Test #90:
score: 0
Accepted
time: 219ms
memory: 52200kb
input:
100000 299812 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 ...
output:
188
result:
ok single line: '188'
Test #91:
score: 0
Accepted
time: 204ms
memory: 52060kb
input:
100000 299745 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 ...
output:
252
result:
ok single line: '252'
Test #92:
score: 0
Accepted
time: 172ms
memory: 52020kb
input:
100000 298695 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 ...
output:
1204
result:
ok single line: '1204'
Test #93:
score: 0
Accepted
time: 188ms
memory: 51764kb
input:
100000 298706 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 ...
output:
2360
result:
ok single line: '2360'
Test #94:
score: 0
Accepted
time: 254ms
memory: 76216kb
input:
200000 297109 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 1 ...
output:
8172
result:
ok single line: '8172'
Test #95:
score: 0
Accepted
time: 222ms
memory: 76360kb
input:
200000 275619 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 0 ...
output:
51484
result:
ok single line: '51484'
Test #96:
score: 0
Accepted
time: 205ms
memory: 97664kb
input:
270000 285567 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 ...
output:
137144
result:
ok single line: '137144'
Test #97:
score: 0
Accepted
time: 187ms
memory: 96864kb
input:
270000 281240 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 ...
output:
359876
result:
ok single line: '359876'
Test #98:
score: 0
Accepted
time: 249ms
memory: 104516kb
input:
300000 299999 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 ...
output:
54472
result:
ok single line: '54472'
Test #99:
score: 0
Accepted
time: 383ms
memory: 98392kb
input:
299999 299998 0 0 0 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 1 1 0 1 0 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1 0 1 0 0 0 1 0 0 1 1 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 0 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 1 1 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1 1 1 1 0 0 0 0 ...
output:
26
result:
ok single line: '26'
Test #100:
score: 0
Accepted
time: 406ms
memory: 99200kb
input:
300000 299999 0 0 0 1 0 1 1 1 1 1 1 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0 1 1 0 0 1 0 1 1 1 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 0 1 0 0 1 0 1 1 0 0 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 1 1 1 1 1 0 1 0 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 1 1 0 0 0 0 1 0 1 0 ...
output:
24
result:
ok single line: '24'
Test #101:
score: 0
Accepted
time: 262ms
memory: 99720kb
input:
300000 299999 0 1 1 1 1 1 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 1 0 1 0 1 0 0 1 1 0 0 1 1 1 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 1 0 1 0 1 1 0 1 1 1 0 0 0 1 0 1 1 0 0 1 0 1 0 1 1 1 1 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0 1 0 1 1 0 1 ...
output:
22
result:
ok single line: '22'
Test #102:
score: 0
Accepted
time: 240ms
memory: 99076kb
input:
300000 299999 1 0 1 0 0 0 0 0 0 1 0 0 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0 0 0 1 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 1 1 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 ...
output:
19
result:
ok single line: '19'
Test #103:
score: 0
Accepted
time: 170ms
memory: 100944kb
input:
300000 299999 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 0 1 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 1 0 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 0 1 0 ...
output:
2
result:
ok single line: '2'
Test #104:
score: 0
Accepted
time: 191ms
memory: 99392kb
input:
300000 299999 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 1 0 0 0 1 0 0 1 1 1 0 0 1 0 0 1 0 1 0 1 0 0 1 1 1 1 0 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 1 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 1 0 1 1 1 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 ...
output:
16
result:
ok single line: '16'
Test #105:
score: 0
Accepted
time: 40ms
memory: 25204kb
input:
300000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
1
result:
ok single line: '1'
Test #106:
score: 0
Accepted
time: 35ms
memory: 22932kb
input:
300000 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
1
result:
ok single line: '1'
Test #107:
score: 0
Accepted
time: 62ms
memory: 24532kb
input:
300000 0 0 0 1 1 1 0 0 0 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 0 1 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 0 1 0 0 0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 1 0 1 0 1 0 0...
output:
2
result:
ok single line: '2'