QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179053#3097. ShoppingCrysfly32.215 127ms16876kbC++202.9kb2023-09-14 17:14:322024-03-11 03:38:52

Judging History

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

  • [2024-03-11 03:38:52]
  • 管理员手动重测该提交记录
  • 测评结果:32.215
  • 用时:127ms
  • 内存:16876kb
  • [2023-09-14 17:14:33]
  • 评测
  • 测评结果:32.215
  • 用时:132ms
  • 内存:16928kb
  • [2023-09-14 17:14:32]
  • 提交

Anna

#include "Anna.h"
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 1000005
#define inf 0x3f3f3f3f
#define B 1384
#define T 723

int n,l,r;

void send(int x){
	Rep(i,17,0)SendA(x>>i&1);
}

void InitA(int N,int L,int R)
{
	n=N,l=L,r=R;
	int bl=L/B,br=R/B;
	int now=0;
	For(i,0,722)
		For(j,i,722){
			if(i==bl&&j==br){
				send(now);
				return;
			}
			++now;
		}
}

int stk[maxn],top,now=1;
void ReceiveA(bool x)
{
	stk[++top]=x;
}

int get(){
	int x=0;
	Rep(i,19,0)
		if(stk[now++])x|=(1<<i);
	return x;
}
int Answer()
{
	vi st,id;
	if(l/B==r/B){
		int b=l/B;
		For(i,b*B,min((b+1)*B-1,n)) id.pb(i);
	}else{
		int bl=l/B,br=r/B;
		For(i,bl*B,(bl+1)*B-1) id.pb(i);
		id.pb(get());
		For(i,br*B,min((br+1)*B-1,n)) id.pb(i); 
	}
	int pos=0;
	int res=-1;
	if(id[0]>=l&&id[0]<=r)res=id[0];
	while(now<=top){
		if(stk[now++]) st.pb(id[pos++]);
		else{
			int fa=st.back(); st.pop_back();
			if(res==fa&&id[pos]>=l&&id[pos]<=r)res=id[pos];
		}
		if(res==-1&&id[pos]>=l&&id[pos]<=r)res=id[pos];
	}
	return res;
}

Bruno

#include "Bruno.h"
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 1000005
#define inf 0x3f3f3f3f
#define B 1384
#define T 723

int n,l,r,p[maxn];

void InitB(int N,vi P)
{
	n=N;
	For(i,0,n-1)p[i]=P[i];
}

int stk[maxn],top,now=1,bl,br;
int get(){
	int x=0;
	Rep(i,17,0)
		if(stk[now++])x|=(1<<i);
	return x;
}
void send(int x){
	Rep(i,19,0)SendB(x>>i&1);
}

void ReceiveB(bool x)
{
	stk[++top]=x;
	if(top==18){
		int bid=get(),now=0,bl,br;
		For(i,0,722)
			For(j,i,722){
				if(bid==now){
					bl=i,br=j;
					i=j=723;
					break;
				}
				++now;
			}
		vi o;
		if(bl==br){
			For(i,bl*B,min((bl+1)*B-1,n)) o.pb(p[i]);
		}else{
			For(i,bl*B,(bl+1)*B-1) o.pb(p[i]);
			int pos=-1;
			For(i,(bl+1)*B,br*B-1) if(pos==-1||p[i]<p[pos]) pos=i;
			if(pos==-1) pos=0,o.pb(inf);
			else o.pb(p[pos]);
			send(pos);
			For(i,br*B,min((br+1)*B-1,n)) o.pb(p[i]);
		}
		vi st;
		for(auto t:o){
			while(st.size()&&st.back()>t)st.pop_back(),SendB(0);
			st.pb(t),SendB(1); 
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 1ms
memory: 5708kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
-1
-1

input:


output:

Accepted: 18 3

result:

ok 

Test #2:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
0
0
1
-1
-1

input:


output:

Accepted: 18 5

result:

ok 

Test #3:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
1
0
0
1
-1
-1

input:


output:

Accepted: 18 7

result:

ok 

Test #4:

score: 1
Accepted
time: 1ms
memory: 5776kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
0
1
1
0
0
1
-1
-1

input:


output:

Accepted: 18 9

result:

ok 

Test #5:

score: 1
Accepted
time: 1ms
memory: 5992kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
0
1
0
0
1
0
0
1
-1
-1

input:


output:

Accepted: 18 11

result:

ok 

Test #6:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
1
1
0
1
0
0
1
1
0
1
1
0
1
0
1
0
0
0
0
1
1
0
1
1
0
1
1
0
0
1
1
0
1
0
1
1
0
1
0
1
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
0
1
1
1
1
0
0
0
1
0
1
0
0
1
1
0
0
0
1
1
1
0
1
1
0
0
0
0
0
0
0
0
1
1
0
1
1
1
0
0
0
1
1
0
1
0
0
1
0
1
0
1
1
1
1
0
0
0
1
1
1
0
0
0
0
1
1
0
1
0
1...

input:


output:

Accepted: 18 1955

result:

ok 

Test #7:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
0
0
1
1
0
0
0
1
1
1
0
0
1
1
1
0
0
1
1
0
0
1
1
1
0
1
0
0
1
1
1
0
0
1
0
0
0
1
0
0
0
1
1
1
0
1
1
0
0
0
1
1
0
1
0
1
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
1
0
1
0
0
0
1
1
0
1
1
0
1
1
0
1
0
0
0
1
1
0
0
0
1
1
0
1
0
0
1
1
1
0
1
1
0
0
1
1
1
0
0
1
1
0
1
0
0
0
1
1
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
1
1...

input:


output:

Accepted: 18 1957

result:

ok 

Test #8:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
1
1
0
1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
1
0
0
1
0
1
0
1
0
0
1
1
1
0
0
0
0
1
1
1
0
1
0
1
1
0
1
1
1
1
0
0
0
0
0
1
1
0
1
1
0
0
0
0
0
0
1
1
1
0
1
0
1
1
0
1
1
1
0
0
0
0
1
1
0
1
1
0
0
0
1
1
0
1
0
0
0
1
1
1
0
1
1
0
1
0
0
0
0
1
1
1
0
0
1
1
0
1
0
1
0
0
0...

input:


output:

Accepted: 18 1941

result:

ok 

Test #9:

score: 1
Accepted
time: 1ms
memory: 6040kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
0
1
1
0
0
0
1
1
0
1
0
0
1
1
0
1
1
0
0
1
0
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
1
0
0
0
0
1
1
1
0
0
1
1
1
0
0
1
1
1
0
0
0
1
0
0
1
1
1
0
0
1
1
0
0
1
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
0
0
0
0
1
1
0
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
0
0
0
0
0
1
0
1
1
0
1
1
1
0
1
1
0
1
1
1
0
1
0
0
0
0
1
1
0
0
1
1
1
0
0
1
0
1
1
0...

input:


output:

Accepted: 18 2001

result:

ok 

Test #10:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
0
1
1
1
0
0
0
0
1
1
0
1
0
1
1
0
0
1
0
0
1
1
0
1
0
0
1
1
1
1
0
1
0
0
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
1
0
1
1
0
1
0
0
1
1
0
0
0
0
0
0
0
1
0
1
1
1
1
0
0
0
1
1
0
1
0
1
0
1
1
0
1
0
0
0
0
1
1
0
1
0
1
1
0
0
1
1
1
0
0
1
1
0
0
0
1
1
0
1
1
0
1
0
0
1
1
0
1
1
0
0
0
1
1
1
0
0
1
0
1
1
0
1
0
0
1
1
1
1
1
0...

input:


output:

Accepted: 18 2001

result:

ok 

Test #11:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
1
0
0
1
1
1
1
0
1
0
0
0
1
1
0
0
0
1
1
0
0
1
0
1
1
1
0
1
1
0
1
0
0
1
1
1
0
0
0
0
1
0
1
1
0
0
1
1
0
1
0
0
1
1
0
1
1
0
0
1
1
1
0
0
0
1
1
1
0
0
0
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
0
0
1
0
0
1
1
0
1
0
0
1
1
0
1
1
0
0
0
0
1
1
1
0
0
1
1
1
0
0
0
0
0
0
1
1
1
0
1
0
0
1
0
0
0
1
1
1
0
1
0
0
1
1
1
0
0
1
1
0...

input:


output:

Accepted: 18 2001

result:

ok 

Test #12:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
1
1
1
1...

input:


output:

Accepted: 18 2001

result:

ok 

Test #13:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
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...

input:


output:

Accepted: 18 2001

result:

ok 

Test #14:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
1
0
0
0
0
0
1
1
0
1
0
0
1
1
0
0
1
1
1
1
1
0
0
1
1
0
0
0
0
1
0
1
1
0
0
0
1
1
1
1
0
0
0
1
1
0
1
1
0
1
0
1
1
0
1
1
1
0
1
1
0
0
0
1
0
0
0
1
1
0
0
0
0
1
1
0
1
0
1
1
1
1
1
0
0
0
0
1
1
0
0
0
1
1
0
1
1
0
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
0
1
0
0
1
0
0
1
1
1
0
0
0
0
0
1
1...

input:


output:

Accepted: 18 2001

result:

ok 

Test #15:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
1
0
0
0
0
1
1
1
0
0
1
0
1
1
0
0
1
1
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
0
1
1
1
0
1
1
0
0
0
1
1
1
0
0
1
0
1
1
0
0
1
1
0
0
1
1
1
1
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
1
1
0
1
0
1
1
1
0
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
1
1
0
0
1
0
1
0
0
0
1
1
0
1
1
0
0
1
1
1
0
0
1
0
0
1
1
0
0
1
0
0
1
1
1
0
0
1
1
0
0
0
0...

input:


output:

Accepted: 18 2001

result:

ok 

Test #16:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0...

input:


output:

Accepted: 18 2001

result:

ok 

Test #17:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0...

input:


output:

Accepted: 18 2001

result:

ok 

Test #18:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
0
1
1
0
0
0
1
1
1
1
0
0
0
1
1
0
1
1
0
1
0
1
0
1
0
0
0
1
1
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
1
0
0
1
0
1
1
1
0
0
0
0
0
1
1
1
1
0
0
1
1
0
1
0
0
1
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
1
1
1
1
0
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0
1
0
1
1
0
1
0
0
0
0
1
1
1
0
0
1
1
0
1
0
0
0
1
1
1
1
0
0
1
0
1
1
1
0
0
1
1...

input:


output:

Accepted: 18 2001

result:

ok 

Test #19:

score: 1
Accepted
time: 1ms
memory: 5736kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
1
0
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
1
0
0
1
1
0
0
0
1
1
1
0
0
1
1
1
0
1
0
0
1
0
0
1
0
0
1
1
1
1
0
0
1
1
1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
1
0
0
0
1
1
0
1
0
1
0
0
1
0
1
1
1
0
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
1
1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
1
0
0
0
1
1
0
0
0
0
1
1
1
0
0
1
1...

input:


output:

Accepted: 18 2001

result:

ok 

Test #20:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
1
0
1
1
1
0
0
0
1
1
0
0
1
1
0
1
0
0
1
0
1
0
1
0
0
1
1
0
1
0
1
1
0
0
1
1
1
0
1
0
1
0
0
0
1
1
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
0
0
1
1
0
1
1
0
1
0
1
0
1
1
1
0
1
0
0
1
1
1
0
0
1
0
0
1
1
0
1
0
1
1
1
1
0
0
1
0
1
0
0
1
0
0
0
1
1
0
1
1
0
1
1
0
1
0
0
1
1
1
0
0
0
0
1
1
0
0
0
0...

input:


output:

Accepted: 18 2001

result:

ok 

Subtask #2:

score: 9
Accepted

Test #21:

score: 9
Accepted
time: 2ms
memory: 5844kb

input:

0
0
0
0
0
0
0
1
0
1
1
0
1
0
1
0
0
1
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
1
0
1
0
1
0
0
1
0
0
1
0
1
1
0
1
0
1
0
1
1
0
1
0
1
0
1
1
0
1
0
0
1
0
0
1
1
0
1
1
0
1
0
0
1
1
0
0
1
0
0
1
0
1
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
0
0
1
1
0
1
1
1
0
0
0
1
1
0
1
1
0
1
0
0
1
1
1
1
0
0
0
1
1
1
0
0
1
1
1
1
0
0
0
0
1
0
0
0
1
1
1
0
0
1
1
0
0
0
1
1
1
0
1
0
1
1
0
1
1
0
1
0
1
0
0
1
1...

input:


output:

Accepted: 18 5549

result:

ok 

Test #22:

score: 9
Accepted
time: 2ms
memory: 5800kb

input:

0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
1
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
1
1
0
0
0
1
1
0
1
1
0
1
1
0
1
0
0
0
1
0
0
1
1
0
1
1
1
0
0
1
0
1
0
1
0
0
0
0
1
1
0
1
0
1
1
0
1
0
1
0
0
1
1
1
0
1
0
0
1
1
0
1
0
1
0
0
1
1
0
1
0
1
1
0
0
1
1
0
1
1
1
0
0
1
1
0
0
0
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
0
0
1
1
0
0
1
1
1
0
0
1
0
0
1
1
0
1
1
0
0
1...

input:


output:

Accepted: 18 5545

result:

ok 

Test #23:

score: 9
Accepted
time: 2ms
memory: 5852kb

input:

0
0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
1
1
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
1
0
0
1
1
0
0
1
0
0
1
1
1
1
1
0
0
1
1
0
1
1
1
0
1
0
1
1
0
0
1
0
0
0
0
1
1
0
1
0
1
1
0
1
1
1
1
1
1
0
0
0
0
0
1
0
1
0
0
1
1
0
1
1
1
1
0
0
0
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
0
1
1
0
1
0
1
1
0
0
0
0
1
1
1
0
0
0
1
0
0
1
1
0
1
0
1
1
1...

input:


output:

Accepted: 18 5551

result:

ok 

Test #24:

score: 9
Accepted
time: 5ms
memory: 5776kb

input:

0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
1
1
0
1
1
0
0
1
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
0
1
0
0
1
1
1
0
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
1
1
0
0
0
1
1
0
0
0
1
1
0
1
0
1
1
1
1
1
0
0
0
0
0
0
1
0
0
1
1
1
0
1
1
0
1
0
0
1
1
0
0
1
1
1
1
0
1
0
0
1
1
0
1
1
1
0
0
0
0
0
0
1
1
1
1
0
1
0
0
0
1
1
0
1
0
0
1
1
0
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1...

input:


output:

Accepted: 18 5546

result:

ok 

Test #25:

score: 9
Accepted
time: 0ms
memory: 5724kb

input:

0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
1
-1
-1
-1

output:

-1
1
0
1
1
1
0
1
0
1
0
1
1
0
1
0
1
1
0
0
0
1
1
1
0
0
1
1
0
0
0
0
0
1
1
0
1
0
1
1
0
1
1
1
0
0
1
1
0
0
0
1
1
1
0
0
1
1
0
1
0
0
0
1
1
0
1
1
0
0
1
0
0
1
1
1
0
0
0
1
1
0
1
1
1
0
0
0
1
1
1
0
1
0
0
0
0
0
1
1
0
1
0
1
1
0
0
1
1
1
1
0
0
1
0
0
1
1
0
0
1
1
0
1
1
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
1...

input:


output:

Accepted: 18 2758

result:

ok 

Test #26:

score: 9
Accepted
time: 0ms
memory: 5776kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
0
0
1
1
1
1
1
0
1
0
1
0
0
1
1
0
1
0
1
1
0
0
0
1
1
1
0
0
1
1
0
1
1
0
0
1
0
1
1
0
0
1
1
0
1
0
0
1
1
0
1
1
0
1
1
0
0
0
1
0
1
1
1
1
0
0
1
0
1
1
1
0
1
0
0
1
0
0
0
1
1
1
1
0
0
1
0
0
1
1
0
0
0
0
1
1
0
0
1
1
0
1
1
0
1
1
1
0
0
0
1
1
0
0
0
0
0
0
0
1
1
1
0
0
1
1
0
1
1
1
0
1
1
0...

input:


output:

Accepted: 18 3415

result:

ok 

Test #27:

score: 9
Accepted
time: 2ms
memory: 6120kb

input:

0
0
0
0
0
0
1
0
1
1
0
1
0
0
0
1
1
1
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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...

input:


output:

Accepted: 18 2790

result:

ok 

Test #28:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
1
1
0
1
1
0
0
0
0
0
1
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
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...

input:


output:

Accepted: 18 5557

result:

ok 

Test #29:

score: 9
Accepted
time: 2ms
memory: 5732kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
1
0
1
0
1
1
0
1
0
0
0
1
0
1
1
1
1
0
0
1
0
0
1
0
1
1
0
1
0
0
1
1
0
1
0
0
1
1
0
1
0
1
0
1
1
0
0
1
1
1
0
0
1
1
0
0
0
1
1
0
1
1
0
0
1
0
0
0
0
1
1
0
1
0
1
1
1
0
0
1
0
1
1
1
1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
1
0
1
1
0
1
0
1
1
0
0
1
0
1
1
1
0
1
1
1
0
0
0
1
1
1
1
0...

input:


output:

Accepted: 18 5545

result:

ok 

Test #30:

score: 9
Accepted
time: 3ms
memory: 5716kb

input:

0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
1
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
1
1
1
0
0
1
0
1
1
1
0
1
1
0
0
1
0
0
0
0
1
1
0
1
1
0
1
0
1
1
0
0
1
1
1
1
0
1
0
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
1
1
0
1
0
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
0
1
0
1
1
0
1
1
0
1
0
0
0
1
1
0
0
1
0
1
1
1
0
0
1
1
0
0...

input:


output:

Accepted: 18 5549

result:

ok 

Test #31:

score: 9
Accepted
time: 0ms
memory: 5780kb

input:

0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
1
1
1
0
1
0
1
0
0
1
1
0
0
1
0
1
1
0
1
0
1
1
0
0
1
1
0
1
0
1
1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
1
0
0
0
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
1
0
0
1
1
1
0
0
1
1
0
0
0
1
1
0
1
0
1
1
0
0
1
1
0
1
0
1
1
0
0
0
0
0
1
1
0
1
1
1
0
0
0
1
1
0
1
0
1
1
0
0
0
1
1
0
1
1
0
1
0
0
1
1...

input:


output:

Accepted: 18 5547

result:

ok 

Test #32:

score: 9
Accepted
time: 5ms
memory: 5848kb

input:

0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
1
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
1
1
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
0
1
1
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
0
0
0
1
1
0
1
0
1
1
0
0
1
1
0
1
0
1
1
0
0
0
1
1
0
1
1
1
0
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
0
1
1
0
0
1
1
0
1
0
1
1
0
0
0
1
1
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
0
0
0
1
1
0
1
0
1...

input:


output:

Accepted: 18 5553

result:

ok 

Test #33:

score: 9
Accepted
time: 5ms
memory: 7852kb

input:

0
0
0
0
0
0
1
0
0
0
0
1
1
1
0
1
1
1
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
1
1
0
1
0
0
0
1
1
0
1
1
0
0
0
1
1
0
1
0
1
1
0
1
1
0
1
0
0
0
1
1
1
0
1
0
1
0
1
0
0
1
1
0
1
1
0
0
1
0
1
1
0
0
1
1
1
1
0
1
0
0
0
1
1
0
0
0
0
1
1
1
1
1
0
0
0
1
1
0
1
0
1
0
0
0
1
0
0
0
0
1
1
0
1
0
1
1
0
0
1
1
1
1
0
1
0
0
0
1
1
0
0
0
1
1
1
0
0
1
0
1
1
0...

input:


output:

Accepted: 18 5437

result:

ok 

Test #34:

score: 9
Accepted
time: 3ms
memory: 5796kb

input:

0
0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
0
1
-1
-1
-1

output:

-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
0
1
0
1
1
1
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
0
1
0
0
1
0
0
0
1
0
1
0
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
1
0
0
1
0
1
0...

input:


output:

Accepted: 18 2761

result:

ok 

Test #35:

score: 9
Accepted
time: 0ms
memory: 5852kb

input:

0
0
0
0
0
1
0
0
0
0
1
1
1
0
0
0
1
1
-1
-1
-1

output:

-1
1
1
1
0
0
1
1
0
1
0
1
0
0
0
1
1
1
1
0
1
0
1
0
0
0
1
1
0
1
1
1
0
1
1
0
1
0
1
1
0
1
0
1
1
1
1
0
0
0
0
0
1
1
1
0
0
0
0
1
1
1
1
0
0
0
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
1
0
0
0
0
0
0
1
1
0
1
0
1
0
1
1
0
1
0
1
1
0
0
1
1
0
1
0
1
0
0
0
1
1
0
1
1
0
1
0
0
1
0
1
0
1
1
1
1
1
0
0
1
1
0
0
0
0
1
1
0
0
0
1
1
1...

input:


output:

Accepted: 18 2764

result:

ok 

Test #36:

score: 9
Accepted
time: 0ms
memory: 7764kb

input:

0
0
0
0
0
1
0
0
0
0
1
1
1
0
0
0
1
1
-1
-1
-1

output:

-1
1
1
1
0
1
0
0
1
1
0
1
0
1
0
1
1
0
1
0
1
1
0
1
1
0
0
1
1
1
0
0
0
1
1
0
1
0
0
1
1
0
0
1
0
0
1
1
1
0
1
0
1
0
0
0
0
0
0
1
1
1
1
0
0
0
1
1
0
1
0
1
1
0
0
0
1
1
1
1
1
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
1
1
1
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
1
0
0
0
0
0
1
1
1
0
1
0
0
0
1
0
0
0
0
0
0
0...

input:


output:

Accepted: 18 2762

result:

ok 

Test #37:

score: 9
Accepted
time: 3ms
memory: 5840kb

input:

0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
1
-1
-1
-1

output:

-1
1
0
1
1
1
0
0
1
1
1
0
0
0
1
1
0
1
0
0
1
0
1
1
0
0
0
1
1
0
1
0
1
1
0
1
1
0
0
1
0
0
0
1
1
1
0
1
0
1
1
0
0
0
1
0
1
1
0
1
0
0
0
1
1
0
1
0
1
1
0
1
0
0
1
1
0
1
1
0
1
0
1
1
0
0
0
0
1
1
1
0
1
0
1
1
0
1
0
1
1
0
0
0
1
1
0
1
1
0
0
0
0
0
1
1
1
1
1
0
0
0
1
0
1
1
0
0
1
1
0
1
0
0
1
1
1
1
0
0
0
1
1
0
1
1
0
0
0
1...

input:


output:

Accepted: 18 2760

result:

ok 

Subtask #3:

score: 22.215
Acceptable Answer

Test #38:

score: 22.26
Acceptable Answer
time: 111ms
memory: 15216kb

input:

0
1
1
1
0
0
1
1
0
1
0
0
1
1
1
1
1
1
-1
-1
-1

output:

-1
0
1
0
0
0
0
0
0
1
1
0
0
1
0
0
1
1
1
1
1
1
0
1
0
1
1
0
1
1
0
0
1
0
0
1
0
1
1
0
1
1
1
0
0
0
1
1
0
0
1
0
1
1
0
0
1
1
1
1
0
0
1
0
0
0
1
1
0
1
1
1
1
0
0
0
1
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
0
0
0
0
0
1
1
1
0
1
0
0
1
1
1
0
1
0
0
0
1
1
0
1
1
0
0
1
1
1
1
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
1
1
0
1
0
1
1
0
1
0...

input:


output:

Accepted: 18 5548

result:

points 0.24733333330

Test #39:

score: 22.26
Acceptable Answer
time: 119ms
memory: 16488kb

input:

1
0
1
0
0
1
1
1
0
0
1
1
1
0
1
1
1
0
-1
-1
-1

output:

-1
0
1
1
1
0
0
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
0
0
1
1
0
1
1
1
0
1
1
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
0
0
1
1
0
0
1
1
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
0
0
0
1
1
1
1
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
1
1
0
0
1
1
1
0
0
0
1
0
0
1
1
0
1
1
1
0
0
0
0
1
1
0
1
0
1
0
0
1
0
0
1
1
1
0
1...

input:


output:

Accepted: 18 5548

result:

points 0.24733333330

Test #40:

score: 47.39
Acceptable Answer
time: 118ms
memory: 16088kb

input:

0
0
1
1
0
1
1
1
0
1
0
0
0
1
1
1
1
0
-1
-1
-1

output:

-1
1
0
1
0
1
1
0
1
1
0
0
1
1
0
0
0
1
1
0
1
1
1
0
0
1
1
0
1
0
0
1
1
0
0
0
1
1
1
1
0
0
0
1
1
1
0
0
0
1
0
0
0
1
1
1
0
0
1
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
1
0
0
0
1
1
1
1
0
0
0
1
1
0
1
1
0
1
0
0
1
1
0
1
0
0
0
0
0
1
1
0
1
1
0
1
0
1
1
1
0
0
0
1
1
0
1
0
0
1
1
0
1
0
0
0
1
1
0
1
1
0
1
1
1
0
0
1
0
1
1
0
1
1
0
0...

input:


output:

Accepted: 18 2761

result:

points 0.52655555560

Test #41:

score: 32.05
Acceptable Answer
time: 116ms
memory: 16372kb

input:

0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
0
-1
-1
-1

output:

-1
0
1
1
0
1
0
0
0
1
1
1
1
0
0
1
1
0
1
1
1
1
0
1
0
1
1
1
0
0
1
1
1
1
0
0
1
0
1
0
0
0
1
1
0
1
1
0
1
1
0
0
1
1
0
0
1
0
0
1
1
1
0
0
0
1
1
1
0
0
1
1
0
1
1
0
0
1
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
1
1
1
0
1
1
1
0
0
1
0
0
1
1
0
1
0
1
1
0
0
0
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
0
0
1
0
0
1
1
0...

input:


output:

Accepted: 18 4295

result:

points 0.35611111110

Test #42:

score: 47.11
Acceptable Answer
time: 120ms
memory: 16360kb

input:

0
1
1
0
1
0
0
0
1
1
0
1
1
1
0
0
1
1
-1
-1
-1

output:

-1
0
0
1
1
1
0
0
0
1
1
0
0
0
1
0
0
0
0
0
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...

input:


output:

Accepted: 18 2789

result:

points 0.52344444440

Test #43:

score: 22.215
Acceptable Answer
time: 116ms
memory: 15188kb

input:

0
1
0
1
1
0
1
1
0
1
0
0
1
1
1
1
0
1
-1
-1
-1

output:

-1
1
0
0
0
1
0
0
1
1
1
0
1
1
0
1
1
1
1
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
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...

input:


output:

Accepted: 18 5557

result:

points 0.24683333330

Test #44:

score: 22.415
Acceptable Answer
time: 119ms
memory: 16108kb

input:

1
1
0
0
1
0
0
1
0
1
0
1
0
0
1
1
0
1
-1
-1
-1

output:

-1
1
0
0
0
0
1
0
0
0
0
0
1
1
1
0
1
1
0
0
0
1
1
0
1
1
0
1
0
0
1
0
0
1
1
0
1
0
1
1
0
0
0
1
1
0
1
0
1
1
0
1
0
1
1
1
0
0
1
1
0
1
0
0
0
1
1
0
0
0
1
0
1
1
1
0
0
0
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...

input:


output:

Accepted: 18 5517

result:

points 0.24905555560

Test #45:

score: 22.235
Acceptable Answer
time: 119ms
memory: 16104kb

input:

1
0
0
1
1
1
1
1
1
0
0
1
0
0
0
0
1
1
-1
-1
-1

output:

-1
0
1
1
0
0
0
1
1
1
0
1
0
1
1
0
1
0
1
1
1
1
0
1
1
0
0
1
1
1
0
1
0
1
1
0
1
1
0
1
0
0
0
0
1
1
0
0
1
1
0
1
0
1
0
0
1
1
0
0
1
1
1
0
1
0
1
0
0
1
0
0
1
1
1
0
0
1
0
0
1
1
1
0
0
1
1
1
0
0
0
1
1
1
0
1
1
0
0
1
0
0
0
1
1
0
1
1
0
0
1
0
1
0
1
1
0
1
0
1
1
1
0
0
1
1
0
0
1
0
0
1
1
0
0
1
0
1
1
1
0
0
1
1
0
1
1
0
1
0...

input:


output:

Accepted: 18 5553

result:

points 0.24705555560

Test #46:

score: 22.405
Acceptable Answer
time: 118ms
memory: 15400kb

input:

1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
0
1
0
1
0
0
1
1
1
0
1
0
0
0
0
1
0
1
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0
0
1
1
0
1
1
0
0
1
1
0
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
0
1
1
0
0
0
1
1
0
1
0
1
0
1
1
0
0
1
1
1
0
0
1
0
0
1
0
1
1
1
0
0
0
1
1
0
0
0
1
1
0
1
1
0
1
0
1
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0...

input:


output:

Accepted: 18 5519

result:

points 0.24894444440

Test #47:

score: 47.4
Acceptable Answer
time: 122ms
memory: 15852kb

input:

1
1
0
0
1
0
1
1
1
0
0
0
1
0
1
0
0
1
-1
-1
-1

output:

-1
1
0
1
1
0
1
1
1
0
0
0
0
1
1
1
1
1
1
0
0
0
1
1
0
1
1
1
1
0
0
0
1
1
0
0
0
0
0
1
0
0
1
0
1
1
1
1
0
1
1
0
1
0
0
0
1
1
0
1
0
0
1
1
0
1
0
0
0
0
0
1
1
0
1
0
1
1
1
0
1
1
0
0
1
1
0
1
0
0
0
1
1
0
1
0
0
0
1
1
0
1
0
1
0
0
1
1
1
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
1
0
1
1
0
1
0
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
1
1...

input:


output:

Accepted: 18 2760

result:

points 0.52666666670

Test #48:

score: 22.3
Acceptable Answer
time: 116ms
memory: 15768kb

input:

0
0
0
1
1
0
1
0
0
1
1
1
1
0
0
0
0
1
-1
-1
-1

output:

-1
0
0
0
1
0
1
1
0
0
0
0
1
0
0
1
1
1
0
0
1
1
1
1
0
0
1
0
0
1
1
0
0
1
1
1
0
1
1
1
1
1
0
0
0
0
0
1
1
1
0
0
0
0
0
1
1
1
1
0
1
0
1
1
1
0
0
0
1
1
0
0
0
0
0
1
1
0
0
1
0
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
0
0
1
1
1
0
1
0
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
0
1
1
1
0
0
0
1
0
0
0
1
1
0
1
0
1
0
1
1
0
1
0
0
1
1
0
1
0
0
1...

input:


output:

Accepted: 18 5540

result:

points 0.24777777780

Test #49:

score: 47.4
Acceptable Answer
time: 109ms
memory: 16752kb

input:

1
0
1
1
1
1
1
0
1
0
1
1
1
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
0
1
1
1
0
0
0
1
0
1
1
0
1
0
0
1
1
0
1
1
1
0
1
0
0
0
0
0
1
1
1
1
0
0
1
1
0
1
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
1
1
1
0
0
0
0
1
1
0
1
1
1
1
1
1
0
0
0
0
1
0
0
0
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
0
0
1
0
0
0
1
1
1
1
0
0
0
1
1
1
1
0
0
0
0
0
1
1
0
1
1
0
1
0
1
1
0
0
0
0
1
0
1
0
1
0
1
1
1
0
0
1
1
0
1
1
1
1
0...

input:


output:

Accepted: 18 2760

result:

points 0.52666666670

Test #50:

score: 47.51
Acceptable Answer
time: 126ms
memory: 16740kb

input:

0
1
0
0
0
1
0
0
0
0
1
1
0
0
1
1
0
0
-1
-1
-1

output:

-1
1
1
1
1
0
0
1
0
0
1
1
0
0
0
1
1
0
0
1
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
0
1
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
0
0
0
0
1
1
1
0
1
1
0
1
0
1
1
0
1
0
1
1
0
0
0
1
1
0
0
0
1
0
1
0
0
1
0
1
1
1
1
1
0
0
1
0
0
0
1
1
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
1
0
0
1
1
1
0
1
1
1
0
0
0
1
0
0
0
0
0
0
0
1
0
1...

input:


output:

Accepted: 18 2749

result:

points 0.52788888890

Test #51:

score: 22.26
Acceptable Answer
time: 113ms
memory: 15508kb

input:

1
1
0
0
0
1
0
0
0
0
0
1
1
0
0
0
1
1
-1
-1
-1

output:

-1
1
0
0
1
1
0
0
0
1
0
0
1
0
1
1
0
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1
0
0
1
1...

input:


output:

Accepted: 18 5548

result:

points 0.24733333330

Test #52:

score: 22.255
Acceptable Answer
time: 112ms
memory: 15540kb

input:

1
1
0
0
0
0
0
1
1
1
1
1
1
1
1
0
1
1
-1
-1
-1

output:

-1
1
0
0
1
1
0
0
0
1
0
0
1
0
1
1
0
1
0
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
0
1
1
0
1
1
0
0
0
1
1
0...

input:


output:

Accepted: 18 5549

result:

points 0.24727777780

Test #53:

score: 33.1
Acceptable Answer
time: 120ms
memory: 15292kb

input:

0
0
1
0
0
0
1
0
0
1
0
0
0
0
0
1
1
0
-1
-1
-1

output:

-1
0
0
0
1
0
0
0
1
0
0
1
1
1
0
1
1
1
0
0
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...

input:


output:

Accepted: 18 4190

result:

points 0.36777777780

Test #54:

score: 27.53
Acceptable Answer
time: 123ms
memory: 15760kb

input:

0
1
1
1
0
1
1
1
0
1
0
1
0
0
0
1
0
1
-1
-1
-1

output:

-1
0
1
0
0
0
0
1
0
0
0
1
1
1
0
1
0
0
0
0
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...

input:


output:

Accepted: 18 4747

result:

points 0.30588888890

Test #55:

score: 22.215
Acceptable Answer
time: 123ms
memory: 16648kb

input:

1
0
1
0
0
1
0
1
1
0
0
1
0
0
0
0
0
1
-1
-1
-1

output:

-1
0
1
1
1
0
0
1
0
1
1
1
0
0
0
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...

input:


output:

Accepted: 18 5557

result:

points 0.24683333330

Test #56:

score: 22.215
Acceptable Answer
time: 119ms
memory: 15004kb

input:

1
1
0
1
1
1
1
0
0
0
1
1
1
0
1
0
0
1
-1
-1
-1

output:

-1
1
0
1
0
0
1
0
0
1
1
1
0
0
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...

input:


output:

Accepted: 18 5557

result:

points 0.24683333330

Test #57:

score: 22.215
Acceptable Answer
time: 123ms
memory: 15480kb

input:

1
0
1
0
1
0
0
0
0
1
1
1
0
0
0
0
1
0
-1
-1
-1

output:

-1
0
1
1
0
1
0
0
0
1
0
1
1
1
1
1
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...

input:


output:

Accepted: 18 5557

result:

points 0.24683333330

Test #58:

score: 23.005
Acceptable Answer
time: 119ms
memory: 16488kb

input:

0
0
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
0
-1
-1
-1

output:

-1
0
0
0
1
0
0
1
1
1
1
1
0
1
1
1
1
1
0
0
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...

input:


output:

Accepted: 18 5399

result:

points 0.25561111110

Test #59:

score: 24.875
Acceptable Answer
time: 127ms
memory: 16876kb

input:

0
1
0
0
0
0
1
0
0
1
1
0
0
0
1
0
0
0
-1
-1
-1

output:

-1
0
0
1
0
0
0
1
0
0
1
1
1
0
1
1
1
0
0
0
0
1
1
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
1
0
0
1
1
1
1
0
1
0
0
1
1
0
1
0
0
0
0
0
1
1
0
1
0
1
1
0
1
0
1
0
0
1
1
0
1
1
1
1
0
0
0
0
0
1
1
1
1
0
0
0
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
1
0
0
0
1
1
1
0
1
0
0
0
1
1
1
0
0
1
1
0
1
1
1
0
1
0
0
0
0
0
0
0
0...

input:


output:

Accepted: 18 5025

result:

points 0.27638888890

Test #60:

score: 22.24
Acceptable Answer
time: 119ms
memory: 15308kb

input:

1
1
1
1
0
1
0
0
1
0
1
0
1
1
1
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
0
1
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
0...

input:


output:

Accepted: 18 5552

result:

points 0.24711111110

Test #61:

score: 22.235
Acceptable Answer
time: 123ms
memory: 15276kb

input:

1
1
1
0
0
1
0
1
0
1
1
0
1
1
0
0
1
1
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
1
1
1
0
0
1
0
0
1
1
0
1
0
0
0
1
1
1
0
0
1
1
1
1
0
1
1
1
0
0
0
0
0
0
1
1
1
0
1
1
0
0
1
0
0
1
1
0
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
0
1
1
0
1
0
1
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
0
1
0
1
1
1
0
0
1
1
0
0
0
1
1
0
1
0
0
1...

input:


output:

Accepted: 18 5553

result:

points 0.24705555560

Test #62:

score: 22.24
Acceptable Answer
time: 123ms
memory: 15744kb

input:

1
1
1
1
1
1
1
1
0
1
0
0
0
1
1
0
1
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
0
0
1
0
1
1
0
1
0
1
0
1
1
0
1
1
0
1
0
0
1
1
1
0
1
0
0
0
0
1
0
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
0
1
0
1
0
1
1
1
0
0
0
0
1
1
0
1
1
0
0
1
0
1
1
1
0
1
0
0
0
0
1
1
0
0
1
0
1
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
0...

input:


output:

Accepted: 18 5552

result:

points 0.24711111110

Test #63:

score: 47.4
Acceptable Answer
time: 127ms
memory: 15108kb

input:

1
0
1
1
1
1
1
1
0
1
1
0
1
1
0
1
1
1
-1
-1
-1

output:

-1
1
1
0
0
1
0
1
1
0
1
1
0
1
0
1
0
1
1
0
0
0
0
1
1
0
0
1
1
0
1
0
1
1
0
0
1
1
1
1
0
1
1
0
0
1
1
1
0
0
0
0
0
0
1
1
0
1
1
0
1
1
1
0
0
1
1
0
1
0
0
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0
1
0
1
0
0
0
1
1
1
0
1
0
1
1
1
1
1
1
0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
0
1
0
0
0
1
1
1
0
0
1
0
0
0
0
0
1
1
1
0
1
1
0
0
1
1
0...

input:


output:

Accepted: 18 2760

result:

points 0.52666666670

Test #64:

score: 47.41
Acceptable Answer
time: 118ms
memory: 16120kb

input:

1
0
0
0
1
0
1
0
0
0
0
1
1
1
0
1
1
1
-1
-1
-1

output:

-1
1
1
0
1
0
0
1
1
0
1
0
1
0
0
1
0
1
0
1
1
1
0
0
0
1
1
0
1
0
1
1
0
1
0
1
1
1
1
0
0
1
1
0
0
0
0
1
1
0
1
0
1
1
0
1
0
0
1
1
1
0
0
0
0
0
1
1
0
1
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
0
0
1
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
1
1
0
0
1
1
1
0
1
1
0
1
0
0
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
0
0
0
1
1...

input:


output:

Accepted: 18 2759

result:

points 0.52677777780

Test #65:

score: 47.39
Acceptable Answer
time: 113ms
memory: 15476kb

input:

1
0
0
0
1
1
0
0
0
0
0
0
0
1
1
0
0
1
-1
-1
-1

output:

-1
1
1
0
1
0
0
1
1
1
1
1
0
0
1
1
0
1
0
1
0
1
1
0
1
1
0
0
0
0
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
0
1
1
0
1
0
1
1
0
1
1
0
0
1
1
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
1
0
1
1
0
0
1
1
0
0
0
0
1
1
1
0
0
1
1
0
1
0
0
0
0
1
0
0
0
0
1
1
0
1
0
1
1
1
0
0
0
1
1
0
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
1
1
1
0
0...

input:


output:

Accepted: 18 2761

result:

points 0.52655555560

Test #66:

score: 47.4
Acceptable Answer
time: 114ms
memory: 15108kb

input:

0
1
1
1
1
0
0
0
0
0
1
1
1
1
0
1
0
1
-1
-1
-1

output:

-1
1
1
0
1
1
1
1
0
1
0
0
0
1
0
0
1
1
0
1
1
0
0
1
1
0
0
0
1
0
0
1
1
1
0
1
1
1
0
0
0
0
1
0
1
0
1
0
1
1
1
0
0
1
1
0
1
0
1
1
1
0
1
1
1
0
1
0
0
0
0
1
1
0
1
1
1
1
0
0
0
0
1
1
1
0
1
1
0
0
1
1
1
0
0
0
0
1
1
1
0
0
0
0
0
1
1
0
1
0
0
0
0
0
1
1
0
1
0
1
1
0
0
1
1
0
0
1
1
0
1
0
0
1
1
1
0
1
1
1
1
0
1
0
0
0
0
0
1
1...

input:


output:

Accepted: 18 2760

result:

points 0.52666666670

Test #67:

score: 47.44
Acceptable Answer
time: 121ms
memory: 16020kb

input:

1
1
0
0
0
0
1
1
0
1
0
0
0
0
1
1
1
0
-1
-1
-1

output:

-1
1
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
1
1
1
0
0
1
0
1
1
0
1
1
0
1
0
0
1
1
0
1
1
1
1
0
0
0
1
0
0
0
0
1
1
0
1
1
1
0
0
0
0
1
1
1
0
0
1
1
0
1
0
0
0
0
1
1
1
0
1
0
0
1
1
0
0
1
1
1
1
0
0
1
1
1
0
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
0
0
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
1
0
0
1
0
0
1
1
1
0
1
0
0
0
0
1
1
1
1
1
0
1
0
0...

input:


output:

Accepted: 18 2756

result:

points 0.52711111110