QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263283#7833. Binary Stringkkkgjyismine4WA 195ms7480kbC++14835b2023-11-24 18:18:022023-11-24 18:18:02

Judging History

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

  • [2023-11-24 18:18:02]
  • 评测
  • 测评结果:WA
  • 用时:195ms
  • 内存:7480kb
  • [2023-11-24 18:18:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int ans[1003],qry[1003][1003];
const int S=16,N=1000;
int sum[1003];
int query(int l,int r){
	cout<<"? "<<l<<" "<<r<<endl;
	int num;cin>>num;return num;
}
void solve(int l,int r){
	for(int i=l;i<=r;++i)
	  for(int j=i;j<=r;++j)qry[i][j]=query(i,j);
	for(int i=0;i<(1<<r-l+1);++i){
	    sum[l-1]=0;
	    for(int j=0;j<r-l+1;++j)sum[l+j]=sum[l+j-1]+((i>>j)&1);
	    int cnt=0;
	    for(int a=l;a<=r;++a)for(int b=a;b<=r;++b)if(qry[a][b]==sum[b]-sum[a-1])++cnt;else --cnt;
	    if(abs(cnt)<=1){
	    	for(int j=0;j<r-l+1;++j)ans[l+j]=((i>>j)&1);
	    	return;
		}
	}
}
int main(){
	mt19937 rnd(time(0));
	for(int i=1;i<=N;){
		int d=S/2+rnd()%(S/2+1);
		solve(i,min(i+d-1,N));i+=d;
	}
	cout<<"! ";for(int i=1;i<=N;++i)putchar(ans[i]+'0');cout<<endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 195ms
memory: 7480kb

input:

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

output:

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

result:

wrong answer 1-st bit is incorrect. Expected 1, found: 0