QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#116582 | #6628. Flip it and Stick it | lmeowdn# | 25 ✓ | 4ms | 4668kb | C++14 | 3.5kb | 2023-06-29 15:45:36 | 2024-05-31 18:29:12 |
Judging History
answer
#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x) {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x) {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x) {return (x==0?-1:__builtin_ctzll(x));}
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
int x=0,w=1; char c=getchar();
while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();}
return x*w;
}
string s,t; int n;
char flip(char c) {
if(c=='0') return '1';
else return '0';
}
void solve0() {
int cnt=0; rep(i,0,n-1) cnt+=(s[i]=='0');
if(cnt) puts("-1"); else puts("0");
}
void solve00() {
int cnt=0; rep(i,0,n-1) cnt+=(s[i]=='0');
if(cnt>(n+1)/2) {puts("-1"); return;}
cnt=0; rep(i,0,n-2) cnt+=(s[i]=='0'&&s[i+1]=='0');
printf("%d\n",cnt);
}
void solve01() {
int cnt=0; rep(i,1,n-1) cnt+=(s[i-1]=='0'&&s[i]=='1');
printf("%d\n",cnt);
}
void solve000() {
int cnt0=0,cnt1=0,cnt=0,ans=0,cur1=0,curo=0;
rep(i,0,n-1) if(s[i]=='0') cnt0++; else cnt1++;
if(cnt0>2*(cnt1+1)) {puts("-1"); return;}
rep(i,0,n-1) if(s[i]=='0') {
++cnt;
if(s[i+1]=='1'||i==n-1) {
if(cnt==1) cur1++;
else if(cnt&1) curo++;
ans+=(cnt-1)/2; cnt=0;
}
}
int cur=max(cur1-curo,0);
int p=max(cur-(2*(cnt1+1)-cnt0),0);
ans+=(p+1)/2; printf("%d\n",ans);
}
void solve010() {
int cnt=0;
rep(i,1,n-2) if(s[i-1]=='0'&&s[i]=='1'&&s[i+1]=='0') cnt++;
printf("%d\n",(cnt+1)/2);
}
void solve011() {
static int f[200005]; int cnt=0,tot=0,ans=0;
per(i,n-1,0) {
if(s[i]=='1') ++cnt;
else f[++tot]=cnt, cnt=0;
}
rep(i,1,tot) if(f[i]>1) ++ans;
printf("%d\n",ans);
}
signed main() {
cin>>s>>t; n=s.size();
if(s.size()<t.size()) return puts("0"), 0;
if(t=="0") {
solve0();
} else if(t=="1") {
rep(i,0,n-1) s[i]=flip(s[i]);
solve0();
} else if(t=="00") {
solve00();
} else if(t=="01") {
solve01();
} else if(t=="10") {
rep(i,0,n-1) s[i]=flip(s[i]);
solve01();
} else if(t=="11") {
rep(i,0,n-1) s[i]=flip(s[i]);
solve00();
} else if(t=="000") {
solve000();
} else if(t=="001") {
reverse(s.begin(),s.end());
rep(i,0,n-1) s[i]=flip(s[i]);
solve011();
} else if(t=="010") {
solve010();
} else if(t=="011") {
solve011();
} else if(t=="100") {
rep(i,0,n-1) s[i]=flip(s[i]);
solve011();
} else if(t=="101") {
rep(i,0,n-1) s[i]=flip(s[i]);
solve010();
} else if(t=="110") {
reverse(s.begin(),s.end());
solve011();
} else if(t=="111") {
rep(i,0,n-1) s[i]=flip(s[i]);
solve000();
} else assert(0);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 0ms
memory: 3484kb
input:
1 0
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
1 1
output:
-1
result:
ok 1 number(s): "-1"
Test #3:
score: 0
Accepted
time: 3ms
memory: 3680kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
-1
result:
ok 1 number(s): "-1"
Test #4:
score: 0
Accepted
time: 3ms
memory: 3860kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 3ms
memory: 3636kb
input:
101001000011101010101001001010010110111111001100110001111101111110110110101011111010001101111001101101010111101100000110001110001100000101111100000110111110001010101101101110001000011010000101000110110010110110100001110001111001010000000010000000101000000100110011101110100111111101111111111110010101...
output:
-1
result:
ok 1 number(s): "-1"
Test #6:
score: 0
Accepted
time: 3ms
memory: 3824kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #7:
score: 0
Accepted
time: 3ms
memory: 3884kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
-1
result:
ok 1 number(s): "-1"
Subtask #2:
score: 3
Accepted
Test #8:
score: 3
Accepted
time: 0ms
memory: 3492kb
input:
0 01
output:
0
result:
ok 1 number(s): "0"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
0 10
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
01 01
output:
1
result:
ok 1 number(s): "1"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
01 10
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
1010101010 10
output:
5
result:
ok 1 number(s): "5"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 0
Accepted
time: 3ms
memory: 3808kb
input:
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 3ms
memory: 3876kb
input:
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
100000
result:
ok 1 number(s): "100000"
Test #16:
score: 0
Accepted
time: 3ms
memory: 4152kb
input:
000110111001011000010001010010010000010100100000011101010000001000110011100000011011100101110110000001000000000011001010001101001110011111001101110010001100000000010000000100100011000111010011100110011101100011000100011001010000010001001010010101100000100000010010110000000001011100100001000010100100...
output:
43860
result:
ok 1 number(s): "43860"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
44072
result:
ok 1 number(s): "44072"
Subtask #3:
score: 4
Accepted
Dependency #2:
100%
Accepted
Test #18:
score: 4
Accepted
time: 0ms
memory: 3488kb
input:
0 01
output:
0
result:
ok 1 number(s): "0"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
0 10
output:
0
result:
ok 1 number(s): "0"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
01 01
output:
1
result:
ok 1 number(s): "1"
Test #21:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
01 10
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
1 00
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1 11
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
10 00
output:
0
result:
ok 1 number(s): "0"
Test #25:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
11 11
output:
-1
result:
ok 1 number(s): "-1"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
1010101010 10
output:
5
result:
ok 1 number(s): "5"
Test #27:
score: 0
Accepted
time: 3ms
memory: 3884kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #28:
score: 0
Accepted
time: 3ms
memory: 3804kb
input:
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #29:
score: 0
Accepted
time: 3ms
memory: 3876kb
input:
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
100000
result:
ok 1 number(s): "100000"
Test #30:
score: 0
Accepted
time: 3ms
memory: 3808kb
input:
001000001110000110101100000001110000011000100001010001110010010101110110111000000000100000010110100000101110001000001010000000010101000010001000100010111010000110000001000001100110001010000010000101001001110100000011001000100100100101000101000100000100001001000000111000100101010010101100101001001010...
output:
43612
result:
ok 1 number(s): "43612"
Test #31:
score: 0
Accepted
time: 3ms
memory: 3812kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
43815
result:
ok 1 number(s): "43815"
Test #32:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
0011001101 00
output:
2
result:
ok 1 number(s): "2"
Test #33:
score: 0
Accepted
time: 3ms
memory: 3812kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
1
result:
ok 1 number(s): "1"
Test #34:
score: 0
Accepted
time: 4ms
memory: 3876kb
input:
011110101001110000100100101010111010100110011010001001000110011111010101111000110100000110010011001010111001000110000110001110110100011111100010111010101101001100101110100001101111110110000100110110111001000001101110011010100110000111101101101111011000110010100100100001000011010100000100110101001000...
output:
50001
result:
ok 1 number(s): "50001"
Test #35:
score: 0
Accepted
time: 3ms
memory: 3900kb
input:
111011011000111010010001101100000110011000000101110011111110010110001010001000011100011100101011110101101001011101010011110100011101111111000011110101010001000011000100110001011110100010111101111110011001010110011001110111001011000000110100000011001110110110000101010100001001110100111010100100100101...
output:
-1
result:
ok 1 number(s): "-1"
Test #36:
score: 0
Accepted
time: 3ms
memory: 3876kb
input:
110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110...
output:
50000
result:
ok 1 number(s): "50000"
Test #37:
score: 0
Accepted
time: 3ms
memory: 3816kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
99999
result:
ok 1 number(s): "99999"
Test #38:
score: 0
Accepted
time: 3ms
memory: 4152kb
input:
000100100001010000001000011101100101000000000000100000101000100110111001000100000000001000100011101100010010100100000011110101010010010001000001000010000011101000011101010010000110000001000000010100001100010011001001010100010001010000001101101001010110011001000001110000001100010001000101000010110000...
output:
24091
result:
ok 1 number(s): "24091"
Test #39:
score: 0
Accepted
time: 3ms
memory: 3804kb
input:
011000011010000110001000000000100110011001001101011100010010100000100011010110010010011101100000011100110100001010000000100010011100001010010100000100000000100010010101110000001000001010111001100001001011101011110011100101110110101010110000100010001110111010111010000000101111010001010000001111111001...
output:
58668
result:
ok 1 number(s): "58668"
Subtask #4:
score: 5
Accepted
Test #40:
score: 5
Accepted
time: 0ms
memory: 3488kb
input:
11 011
output:
0
result:
ok 1 number(s): "0"
Test #41:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
0 110
output:
0
result:
ok 1 number(s): "0"
Test #42:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
01 100
output:
0
result:
ok 1 number(s): "0"
Test #43:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
110 110
output:
1
result:
ok 1 number(s): "1"
Test #44:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
010 001
output:
0
result:
ok 1 number(s): "0"
Test #45:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
001001001001 001
output:
4
result:
ok 1 number(s): "4"
Test #46:
score: 0
Accepted
time: 3ms
memory: 4668kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #47:
score: 0
Accepted
time: 3ms
memory: 4156kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
0
result:
ok 1 number(s): "0"
Test #48:
score: 0
Accepted
time: 3ms
memory: 4148kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
24856
result:
ok 1 number(s): "24856"
Test #49:
score: 0
Accepted
time: 3ms
memory: 4412kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
0
result:
ok 1 number(s): "0"
Test #50:
score: 0
Accepted
time: 3ms
memory: 4420kb
input:
010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010...
output:
62521
result:
ok 1 number(s): "62521"
Test #51:
score: 0
Accepted
time: 3ms
memory: 4136kb
input:
011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011...
output:
66666
result:
ok 1 number(s): "66666"
Test #52:
score: 0
Accepted
time: 0ms
memory: 4120kb
input:
110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110...
output:
66666
result:
ok 1 number(s): "66666"
Subtask #5:
score: 5
Accepted
Test #53:
score: 5
Accepted
time: 0ms
memory: 3540kb
input:
11 011
output:
0
result:
ok 1 number(s): "0"
Test #54:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
01 100
output:
0
result:
ok 1 number(s): "0"
Test #55:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
011 011
output:
1
result:
ok 1 number(s): "1"
Test #56:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
010 100
output:
0
result:
ok 1 number(s): "0"
Test #57:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
0 010
output:
0
result:
ok 1 number(s): "0"
Test #58:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
10 101
output:
0
result:
ok 1 number(s): "0"
Test #59:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
010 010
output:
1
result:
ok 1 number(s): "1"
Test #60:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
000 101
output:
0
result:
ok 1 number(s): "0"
Test #61:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
001001001001 100
output:
3
result:
ok 1 number(s): "3"
Test #62:
score: 0
Accepted
time: 3ms
memory: 4652kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #63:
score: 0
Accepted
time: 3ms
memory: 3804kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
0
result:
ok 1 number(s): "0"
Test #64:
score: 0
Accepted
time: 3ms
memory: 4120kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
25010
result:
ok 1 number(s): "25010"
Test #65:
score: 0
Accepted
time: 3ms
memory: 4408kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
0
result:
ok 1 number(s): "0"
Test #66:
score: 0
Accepted
time: 4ms
memory: 4096kb
input:
110001101111100110100110010110111101001001110110101110011010011000101000011001110011100111110111100001111111101011001001010111001100001001000001010000100010001001010101000101100011110110001100101110101101001100011101110111011110000111111110110110001001001100110110111001010001111111101100111011111011...
output:
62502
result:
ok 1 number(s): "62502"
Test #67:
score: 0
Accepted
time: 3ms
memory: 4140kb
input:
011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011...
output:
66666
result:
ok 1 number(s): "66666"
Test #68:
score: 0
Accepted
time: 3ms
memory: 4144kb
input:
110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110...
output:
66666
result:
ok 1 number(s): "66666"
Test #69:
score: 0
Accepted
time: 3ms
memory: 3872kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
11173
result:
ok 1 number(s): "11173"
Test #70:
score: 0
Accepted
time: 3ms
memory: 3892kb
input:
101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101...
output:
33333
result:
ok 1 number(s): "33333"
Test #71:
score: 0
Accepted
time: 3ms
memory: 4048kb
input:
011011011000000110101011001010010101000100000000110110100011001001010001001100110100001000101001100000001100101000001111010100001001010011000000101000110110100010001110110111101010010000110110000000100000101000100100000000010111101000011000010010100011000000010001000000000110101000010010010000011000...
output:
7665
result:
ok 1 number(s): "7665"
Test #72:
score: 0
Accepted
time: 3ms
memory: 4152kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #73:
score: 0
Accepted
time: 3ms
memory: 3876kb
input:
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
50000
result:
ok 1 number(s): "50000"
Test #74:
score: 0
Accepted
time: 3ms
memory: 4072kb
input:
010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010...
output:
0
result:
ok 1 number(s): "0"
Subtask #6:
score: 7
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Test #75:
score: 7
Accepted
time: 0ms
memory: 3484kb
input:
111 111
output:
-1
result:
ok 1 number(s): "-1"
Test #76:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
000001111000 000
output:
3
result:
ok 1 number(s): "3"
Test #77:
score: 0
Accepted
time: 3ms
memory: 4080kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #78:
score: 0
Accepted
time: 4ms
memory: 3760kb
input:
001001001100001001010101000100000101111110000100001100100100010000010101000011011001010001101000011000000100010000101000110000100001001001001000100000011100011000000101100100111110010001100010000000000000000001000000000011010000001000101000100111000011011110101010101001001010101001100011011000001010...
output:
37010
result:
ok 1 number(s): "37010"
Test #79:
score: 0
Accepted
time: 3ms
memory: 3680kb
input:
000110000100010001001000000000000010100000100100000110010001100000110000001011000011000000001011110100000101001000011101000100100110110001000000000010001011100011011010001000001111000101000010011000011110000001000011100110000011000101010101000001101101100011111000101011000000100100011000000101000000...
output:
-1
result:
ok 1 number(s): "-1"
Test #80:
score: 0
Accepted
time: 3ms
memory: 3804kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
66666
result:
ok 1 number(s): "66666"
Test #81:
score: 0
Accepted
time: 3ms
memory: 3764kb
input:
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
66666
result:
ok 1 number(s): "66666"
Test #82:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001...
output:
55907
result:
ok 1 number(s): "55907"
Test #83:
score: 0
Accepted
time: 0ms
memory: 4076kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
45153
result:
ok 1 number(s): "45153"
Test #84:
score: 0
Accepted
time: 3ms
memory: 3640kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
-1
result:
ok 1 number(s): "-1"
Test #85:
score: 0
Accepted
time: 3ms
memory: 3808kb
input:
000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001...
output:
40000
result:
ok 1 number(s): "40000"
Test #86:
score: 0
Accepted
time: 3ms
memory: 3804kb
input:
000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001...
output:
35000
result:
ok 1 number(s): "35000"
Test #87:
score: 0
Accepted
time: 3ms
memory: 3872kb
input:
110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110...
output:
19999
result:
ok 1 number(s): "19999"
Test #88:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
11 011
output:
0
result:
ok 1 number(s): "0"
Test #89:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
01 100
output:
0
result:
ok 1 number(s): "0"
Test #90:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
110 110
output:
1
result:
ok 1 number(s): "1"
Test #91:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
010 001
output:
0
result:
ok 1 number(s): "0"
Test #92:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
001001001001 001
output:
4
result:
ok 1 number(s): "4"
Test #93:
score: 0
Accepted
time: 3ms
memory: 4600kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #94:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
0
result:
ok 1 number(s): "0"
Test #95:
score: 0
Accepted
time: 3ms
memory: 4440kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
24966
result:
ok 1 number(s): "24966"
Test #96:
score: 0
Accepted
time: 3ms
memory: 4328kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
0
result:
ok 1 number(s): "0"
Test #97:
score: 0
Accepted
time: 3ms
memory: 4164kb
input:
010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010...
output:
62448
result:
ok 1 number(s): "62448"
Test #98:
score: 0
Accepted
time: 0ms
memory: 4084kb
input:
011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011...
output:
66666
result:
ok 1 number(s): "66666"
Test #99:
score: 0
Accepted
time: 3ms
memory: 4028kb
input:
110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110...
output:
66666
result:
ok 1 number(s): "66666"
Test #100:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
0 010
output:
0
result:
ok 1 number(s): "0"
Test #101:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
10 101
output:
0
result:
ok 1 number(s): "0"
Test #102:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
010 010
output:
1
result:
ok 1 number(s): "1"
Test #103:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
000 101
output:
0
result:
ok 1 number(s): "0"
Test #104:
score: 0
Accepted
time: 3ms
memory: 4152kb
input:
111001110000110010010100100011001001101111100000000010011100001110010001111011111100100111110011010101100010111110110100001011100010000101000001111001100110000001101100010000111111100110110100010001101010101000010101100100110110011000000110010110000101001010100011110110001111100001011110000100101010...
output:
62460
result:
ok 1 number(s): "62460"
Test #105:
score: 0
Accepted
time: 3ms
memory: 4052kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
11329
result:
ok 1 number(s): "11329"
Test #106:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101...
output:
33333
result:
ok 1 number(s): "33333"
Test #107:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
010001001000001000010000000000100000000000101101000100000001110000100001001100100110101100000011101001010001001000000100000000000001010100001000011100101100100001000101000100110101100100100011001000100100010011001011100011000011100110000111110100000110110000100000001010011000101010011001000001001000...
output:
7813
result:
ok 1 number(s): "7813"
Test #108:
score: 0
Accepted
time: 3ms
memory: 4152kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #109:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
50000
result:
ok 1 number(s): "50000"
Test #110:
score: 0
Accepted
time: 3ms
memory: 3884kb
input:
010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010...
output:
0
result:
ok 1 number(s): "0"
Test #111:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
00 000
output:
0
result:
ok 1 number(s): "0"
Test #112:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
101 111
output:
0
result:
ok 1 number(s): "0"
Extra Test:
score: 0
Extra Test Passed