QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#179053#3097. ShoppingCrysfly32.215 132ms16928kbC++202.9kb2023-09-14 17:14:322023-09-14 17:14:33

Judging History

你现在查看的是测评时间为 2023-09-14 17:14:33 的历史记录

  • [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); 
		}
	}
}

詳細信息

Subtask #1:

score: 1
Accepted

Test #1:

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

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

input:


output:

Accepted: 18 5

result:

ok 

Test #3:

score: 1
Accepted
time: 0ms
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
0
1
1
0
0
1
-1
-1

input:


output:

Accepted: 18 7

result:

ok 

Test #4:

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

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: 5760kb

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: 6032kb

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: 0ms
memory: 6036kb

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: 3ms
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
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: 5684kb

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: 0ms
memory: 6036kb

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: 5800kb

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: 2ms
memory: 5756kb

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: 1ms
memory: 6036kb

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: 5808kb

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: 2ms
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
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: 6036kb

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: 2ms
memory: 5740kb

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: 6048kb

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: 2ms
memory: 5800kb

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: 6048kb

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: 3ms
memory: 6124kb

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: 0ms
memory: 5808kb

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: 5ms
memory: 6096kb

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: 6120kb

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: 3ms
memory: 6128kb

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: 2ms
memory: 6108kb

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: 1ms
memory: 5844kb

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: 2ms
memory: 5828kb

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: 5ms
memory: 5800kb

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: 2ms
memory: 5868kb

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: 5ms
memory: 5792kb

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: 2ms
memory: 5796kb

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: 2ms
memory: 5768kb

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: 0ms
memory: 5848kb

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: 5848kb

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: 3ms
memory: 5792kb

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: 0ms
memory: 5756kb

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: 118ms
memory: 15868kb

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: 120ms
memory: 16096kb

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: 121ms
memory: 15088kb

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: 117ms
memory: 15128kb

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: 115ms
memory: 16124kb

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: 128ms
memory: 16656kb

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: 117ms
memory: 16368kb

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: 118ms
memory: 15004kb

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: 132ms
memory: 16688kb

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: 114ms
memory: 16920kb

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: 123ms
memory: 15344kb

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: 126ms
memory: 15320kb

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: 118ms
memory: 15332kb

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: 124ms
memory: 15144kb

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: 124ms
memory: 16828kb

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: 119ms
memory: 15864kb

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: 16572kb

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: 118ms
memory: 14924kb

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: 15280kb

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: 116ms
memory: 16792kb

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: 120ms
memory: 16928kb

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: 119ms
memory: 15716kb

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: 114ms
memory: 16360kb

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: 16920kb

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: 120ms
memory: 16056kb

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: 113ms
memory: 15508kb

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: 122ms
memory: 15260kb

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: 119ms
memory: 16328kb

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: 122ms
memory: 16772kb

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: 118ms
memory: 15360kb

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