QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263270#7833. Binary Stringkkkgjyismine4WA 12ms3724kbC++14720b2023-11-24 18:04:522023-11-24 18:04:52

Judging History

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

  • [2023-11-24 18:04:52]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:3724kb
  • [2023-11-24 18:04:52]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int N,a[1003],sum[1003];
int pef[1003][11];
int query(int l,int r){
	cout<<"? "<<l<<" "<<r<<endl;
	int num;cin>>num;
	return num;
}
bool flag;
void dfs(int u,int cnt,int all){
	if(flag)return;
	if(u>N){
		cout<<"! ";
		for(int i=1;i<=N;++i)putchar(a[i]+'0');
		cout<<endl;
		flag=1;
		return;
	}
	for(int v=0;v<2;++v){
		a[u]=v;sum[u]=sum[u-1]+a[u];
		int cnt1=cnt,len=all+min(u,10);
		for(int i=1;i<=min(u,10);++i)cnt1+=(pef[u][i]==(sum[u]-sum[u-i]));
		if(2*cnt1-len<-1)continue;
		dfs(u+1,cnt1,len);
	}
}
int main(){
    N=1000;
	for(int i=1;i<=N;++i)
		for(int j=1;j<=min(i,10);++j)
			pef[i][j]=query(i-j+1,i);
	dfs(1,0,0);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 12ms
memory: 3724kb

input:

1
0
1
0
0
3
1
1
3
2
1
2
2
2
0
1
1
3
3
3
6
0
1
1
1
5
3
3
0
1
0
0
1
5
1
2
1
1
0
4
3
1
7
2
3
0
2
1
1
3
0
4
3
3
4
0
1
1
4
1
1
7
8
3
10
0
2
1
1
1
1
1
7
2
3
0
1
1
0
2
3
2
2
3
8
1
1
2
2
5
2
7
2
4
9
1
0
3
1
2
3
3
4
9
3
1
1
2
2
3
6
0
2
4
2
1
0
0
3
5
0
4
5
5
5
0
2
0
3
3
0
5
5
5
4
1
2
0
4
4
0
2
4
2
10
0
0
2
3
...

output:

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

result:

wrong output format Unexpected end of file - token expected