QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#770296#4884. Battleship: New RulesI_be_wannaAC ✓38ms11600kbC++143.1kb2024-11-21 21:23:032024-11-21 21:23:04

Judging History

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

  • [2024-11-21 21:23:04]
  • 评测
  • 测评结果:AC
  • 用时:38ms
  • 内存:11600kb
  • [2024-11-21 21:23:03]
  • 提交

answer

#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 400005
#define inf 0x3f3f3f3f

int n;
int vis[1005][1005],b[1005][1005];

int q(int x,int y){
	//cout<<"q "<<x<<" "<<y<<"\n";
	if(x<1||y<1||x>=n||y>=n)return 0;
	if(~vis[x][y])return vis[x][y];
	cout<<"? "<<x<<" "<<y<<endl;
	cin>>vis[x][y]; return vis[x][y];
}
int Q(int x,int y){
	For(i,0,1)For(j,0,1)if(q(x+i,y+j))return 1;
	return 0;
}

bool chk(int x1,int x2,int y1,int y2){
	int res=0;
	For(i,x1,x2)For(j,y1,y2)res^=(!b[i][j]);
	return res;
}

void mark(int x,int y){
	if(q(x,y)) b[x][y]=b[x+1][y+1]=b[x][y+1]=b[x+1][y]=1;
}

void solve(int x1,int x2,int y1,int y2){
//	cout<<"solve "<<x1<<" "<<x2<<" "<<y1<<" "<<y2<<"\n";
	if(x1==x2&&y1==y2){
		cout<<"! "<<x1-1<<" "<<y1-1<<endl;
		return;
	}
	if(x2-x1>y2-y1){
		int mid=x1+x2>>1;
		For(i,y1,y2-1) mark(mid,i);
		if(chk(x1,mid,y1,y2))solve(x1,mid,y1,y2);
		else solve(mid+1,x2,y1,y2);
	}else{
		int mid=y1+y2>>1;
		For(i,x1,x2-1) mark(i,mid);
		if(chk(x1,x2,y1,mid))solve(x1,x2,y1,mid);
		else solve(x1,x2,mid+1,y2);
	}
}

void work()
{
	cin>>n;++n;
	For(i,0,n)For(j,0,n)vis[i][j]=-1,b[i][j]=0;
	if(n%2==0){
		cout<<"! "<<-1<<" "<<-1<<endl;
		return;
	}
	solve(1,n,1,n);
}

signed main()
{
	int T;cin>>T;
	while(T--){
		work();
		int x;cin>>x;
	}
	return 0;
}
/*#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 400005
#define inf 0x3f3f3f3f

int n;
int vis[1005][1005],b[1005][1005];

int q(int x,int y){
	//cout<<"q "<<x<<" "<<y<<"\n";
	if(x<1||y<1||x>=n||y>=n)return 0;
	if(~vis[x][y])return vis[x][y];
	cout<<"? "<<x<<" "<<y<<endl;
	cin>>vis[x][y]; return vis[x][y];
}
int Q(int x,int y){
	For(i,0,1)For(j,0,1)if(q(x+i,y+j))return 1;
	return 0;
}

bool chk(int x1,int x2,int y1,int y2){
	int res=0;
	For(i,x1,x2)For(j,y1,y2)res^=(!b[i][j]);
	return res;
}

void mark(int x,int y){
	if(q(x,y)) b[x][y]=b[x+1][y+1]=b[x][y+1]=b[x+1][y]=1;
}

void solve(int x1,int x2,int y1,int y2){
//	cout<<"solve "<<x1<<" "<<x2<<" "<<y1<<" "<<y2<<"\n";
	if(x1==x2&&y1==y2){
		cout<<"! "<<x1-1<<" "<<y1-1<<endl;
		return;
	}
	if(x2-x1>y2-y1){
		int mid=x1+x2>>1;
		For(i,y1,y2-1) mark(mid,i);
		if(chk(x1,mid,y1,y2))solve(x1,mid,y1,y2);
		else solve(mid+1,x2,y1,y2);
	}else{
		work();
		int x;cin>>x;
	}
	return 0;
}*/

详细

Test #1:

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

input:

2
3
1
4
0
0
0
1
1
0
1
0
1

output:

! -1 -1
? 1 3
? 2 3
? 3 3
? 4 3
? 3 1
? 3 2
? 1 2
? 2 2
! 2 2

result:

ok max_C=2.00, avg_C=1.00 (2 test cases)

Test #2:

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

input:

100
4
0
0
0
1
1
0
1
0
1
4
0
0
0
1
1
0
1
0
1
4
1
0
0
0
0
0
0
0
1
4
1
0
0
0
0
0
0
0
1
4
0
0
0
1
1
0
1
0
1
4
0
0
0
1
1
0
1
0
1
4
0
0
0
1
1
0
1
0
1
4
1
0
0
0
0
0
0
0
1
4
1
0
0
0
0
0
0
0
1
4
1
0
0
0
0
0
0
0
1
4
1
0
0
0
0
0
0
0
1
4
0
0
0
1
1
0
1
0
1
4
1
0
0
0
0
0
0
0
1
4
0
0
0
1
1
0
1
0
1
4
0
0
0
1
1
0
1
...

output:

? 1 3
? 2 3
? 3 3
? 4 3
? 3 1
? 3 2
? 1 2
? 2 2
! 2 2
? 1 3
? 2 3
? 3 3
? 4 3
? 3 1
? 3 2
? 1 2
? 2 2
! 2 2
? 1 3
? 2 3
? 3 3
? 4 3
? 3 1
? 3 2
? 1 2
? 2 2
! 2 2
? 1 3
? 2 3
? 3 3
? 4 3
? 3 1
? 3 2
? 1 2
? 2 2
! 2 2
? 1 3
? 2 3
? 3 3
? 4 3
? 3 1
? 3 2
? 1 2
? 2 2
! 2 2
? 1 3
? 2 3
? 3 3
? 4 3
? 3 1
...

result:

ok max_C=2.00, avg_C=2.00 (100 test cases)

Test #3:

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

input:

100
10
1
0
1
1
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
0
1
0
0
0
1
10
1
0
1
0
1
0
1
0
0
0
0
1
0
1
0
0
0
1
0
0
0
1
0
1
10
1
0
1
0
1
0
1
1
0
1
1
1
0
0
0
1
0
1
1
0
0
1
0
1
0
1
10
1
0
1
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
1
10
1
0
0
0
0
0
0
1
0
1
1
1
0
1
1
0
0
0
0
0
1
0
1
10
1
0
1
0
1
1
0
0
0
0
1
0
0
0
0
1
0
1
...

output:

? 1 6
? 2 6
? 3 6
? 4 6
? 5 6
? 6 6
? 7 6
? 8 6
? 9 6
? 10 6
? 6 1
? 6 2
? 6 3
? 6 4
? 6 5
? 1 3
? 2 3
? 3 3
? 4 3
? 5 3
? 3 1
? 3 2
? 4 2
? 5 2
! 4 2
? 1 6
? 2 6
? 3 6
? 4 6
? 5 6
? 6 6
? 7 6
? 8 6
? 9 6
? 10 6
? 6 7
? 6 8
? 6 9
? 6 10
? 7 9
? 8 9
? 9 9
? 10 9
? 9 7
? 9 8
? 7 8
? 8 8
? 8 7
! 8 6
? ...

result:

ok max_C=2.60, avg_C=2.39 (100 test cases)

Test #4:

score: 0
Accepted
time: 2ms
memory: 5880kb

input:

100
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
49
1
4...

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

result:

ok max_C=0.00, avg_C=0.00 (100 test cases)

Test #5:

score: 0
Accepted
time: 0ms
memory: 5904kb

input:

100
50
1
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
1
0
1
1
0
1
1
1
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
50
1
0
1
0
1
0
1
0
1
...

output:

? 1 26
? 2 26
? 3 26
? 4 26
? 5 26
? 6 26
? 7 26
? 8 26
? 9 26
? 10 26
? 11 26
? 12 26
? 13 26
? 14 26
? 15 26
? 16 26
? 17 26
? 18 26
? 19 26
? 20 26
? 21 26
? 22 26
? 23 26
? 24 26
? 25 26
? 26 26
? 27 26
? 28 26
? 29 26
? 30 26
? 31 26
? 32 26
? 33 26
? 34 26
? 35 26
? 36 26
? 37 26
? 38 26
? 39 ...

result:

ok max_C=2.86, avg_C=2.77 (100 test cases)

Test #6:

score: 0
Accepted
time: 8ms
memory: 9920kb

input:

100
31
1
23
1
62
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
1
0
1
1
0
1
1
1
0
1
1
1
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1
1
1
1
1
1
1
1...

output:

! -1 -1
! -1 -1
? 1 32
? 2 32
? 3 32
? 4 32
? 5 32
? 6 32
? 7 32
? 8 32
? 9 32
? 10 32
? 11 32
? 12 32
? 13 32
? 14 32
? 15 32
? 16 32
? 17 32
? 18 32
? 19 32
? 20 32
? 21 32
? 22 32
? 23 32
? 24 32
? 25 32
? 26 32
? 27 32
? 28 32
? 29 32
? 30 32
? 31 32
? 32 32
? 33 32
? 34 32
? 35 32
? 36 32
? 37 ...

result:

ok max_C=2.94, avg_C=1.26 (100 test cases)

Test #7:

score: 0
Accepted
time: 24ms
memory: 5832kb

input:

100
50
1
0
1
1
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
1
1
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
1
1
1
0
1
0
1
1
1
1
1
0
1
1
0
1
0
1
0
1
0
0
0
0
0
1
1
0
1
1
0
1
0
1
0
1
0
0
0
0
1
0
1
1
0
1
50
1
0
1
0
0
0
1
0
...

output:

? 1 26
? 2 26
? 3 26
? 4 26
? 5 26
? 6 26
? 7 26
? 8 26
? 9 26
? 10 26
? 11 26
? 12 26
? 13 26
? 14 26
? 15 26
? 16 26
? 17 26
? 18 26
? 19 26
? 20 26
? 21 26
? 22 26
? 23 26
? 24 26
? 25 26
? 26 26
? 27 26
? 28 26
? 29 26
? 30 26
? 31 26
? 32 26
? 33 26
? 34 26
? 35 26
? 36 26
? 37 26
? 38 26
? 39 ...

result:

ok max_C=2.88, avg_C=2.79 (100 test cases)

Test #8:

score: 0
Accepted
time: 20ms
memory: 5888kb

input:

100
50
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1
0
0
0
1
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
1
0
1
0
1
0
1
1
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
1
0
1
50
1
0
1
0
...

output:

? 1 26
? 2 26
? 3 26
? 4 26
? 5 26
? 6 26
? 7 26
? 8 26
? 9 26
? 10 26
? 11 26
? 12 26
? 13 26
? 14 26
? 15 26
? 16 26
? 17 26
? 18 26
? 19 26
? 20 26
? 21 26
? 22 26
? 23 26
? 24 26
? 25 26
? 26 26
? 27 26
? 28 26
? 29 26
? 30 26
? 31 26
? 32 26
? 33 26
? 34 26
? 35 26
? 36 26
? 37 26
? 38 26
? 39 ...

result:

ok max_C=2.88, avg_C=2.78 (100 test cases)

Test #9:

score: 0
Accepted
time: 24ms
memory: 10712kb

input:

10
500
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
1
1
0
1
0
1
0
1
0...

output:

? 1 251
? 2 251
? 3 251
? 4 251
? 5 251
? 6 251
? 7 251
? 8 251
? 9 251
? 10 251
? 11 251
? 12 251
? 13 251
? 14 251
? 15 251
? 16 251
? 17 251
? 18 251
? 19 251
? 20 251
? 21 251
? 22 251
? 23 251
? 24 251
? 25 251
? 26 251
? 27 251
? 28 251
? 29 251
? 30 251
? 31 251
? 32 251
? 33 251
? 34 251
? 3...

result:

ok max_C=2.97, avg_C=2.97 (10 test cases)

Test #10:

score: 0
Accepted
time: 23ms
memory: 11536kb

input:

10
597
1
1000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
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
0
0
0
0
0
0
1
0
1
0
...

output:

! -1 -1
? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34...

result:

ok max_C=2.98, avg_C=1.75 (10 test cases)

Test #11:

score: 0
Accepted
time: 0ms
memory: 11600kb

input:

5
999
1
999
1
999
1
999
1
999
1

output:

! -1 -1
! -1 -1
! -1 -1
! -1 -1
! -1 -1

result:

ok max_C=0.00, avg_C=0.00 (5 test cases)

Test #12:

score: 0
Accepted
time: 32ms
memory: 11532kb

input:

5
1000
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
1
1
1
1
1
1
0
1
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0...

output:

? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34 501
? 3...

result:

ok max_C=2.98, avg_C=2.98 (5 test cases)

Test #13:

score: 0
Accepted
time: 38ms
memory: 11456kb

input:

5
1000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
1
1
0
1
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1...

output:

? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34 501
? 3...

result:

ok max_C=2.99, avg_C=2.98 (5 test cases)

Test #14:

score: 0
Accepted
time: 19ms
memory: 11532kb

input:

5
1000
0
0
0
1
0
1
0
1
0
1
1
1
0
0
0
0
0
1
0
0
0
0
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
1
0
1
1
1
1
0
1
0
1
0
1
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
1
0
1
0
1
0
0
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0...

output:

? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34 501
? 3...

result:

ok max_C=2.98, avg_C=2.98 (5 test cases)

Test #15:

score: 0
Accepted
time: 17ms
memory: 11512kb

input:

5
1000
1
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
0
0
1
0
1
1
1...

output:

? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34 501
? 3...

result:

ok max_C=2.98, avg_C=2.98 (5 test cases)

Test #16:

score: 0
Accepted
time: 17ms
memory: 11576kb

input:

5
1000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34 501
? 3...

result:

ok max_C=2.98, avg_C=2.98 (5 test cases)

Test #17:

score: 0
Accepted
time: 25ms
memory: 11532kb

input:

5
1000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0...

output:

? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34 501
? 3...

result:

ok max_C=2.98, avg_C=2.98 (5 test cases)

Test #18:

score: 0
Accepted
time: 21ms
memory: 11516kb

input:

5
1000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0...

output:

? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34 501
? 3...

result:

ok max_C=2.98, avg_C=2.98 (5 test cases)

Test #19:

score: 0
Accepted
time: 24ms
memory: 11524kb

input:

5
1000
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34 501
? 3...

result:

ok max_C=2.98, avg_C=2.98 (5 test cases)

Test #20:

score: 0
Accepted
time: 10ms
memory: 11516kb

input:

5
1000
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0...

output:

? 1 501
? 2 501
? 3 501
? 4 501
? 5 501
? 6 501
? 7 501
? 8 501
? 9 501
? 10 501
? 11 501
? 12 501
? 13 501
? 14 501
? 15 501
? 16 501
? 17 501
? 18 501
? 19 501
? 20 501
? 21 501
? 22 501
? 23 501
? 24 501
? 25 501
? 26 501
? 27 501
? 28 501
? 29 501
? 30 501
? 31 501
? 32 501
? 33 501
? 34 501
? 3...

result:

ok max_C=2.98, avg_C=2.98 (5 test cases)