QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#263469#7833. Binary StringzqsWA 6ms8664kbC++141.3kb2023-11-24 21:11:382023-11-24 21:11:38

Judging History

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

  • [2023-11-24 21:11:38]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:8664kb
  • [2023-11-24 21:11:38]
  • 提交

answer

#include <cstdio>
#include <cstring>
#include <random>
#include <ctime>

std::mt19937 rnd(time(NULL));
int adjust(int x) {
	if (x <= 0) x = 0;
	else x = 1;
	return x;
}
int sum[1005][1005], real[1005][1005], buc[1005], n = 1000, m = 500;
int a[1005];
bool vis[1005][1005];
inline bool ask(int l, int r) {
	if (!vis[l][r]) {
		printf("? %d %d\n", l, r);
		fflush(stdout);
//		if(rnd()&1)sum[l][r]=a[r]-a[l-1];
//		else sum[l][r]=rnd()%(r-l+2);
		scanf("%d", &sum[l][r]);
		vis[l][r] = true;
	}
	return sum[l][r];
}

int main() {
	for (int len = m - 1; len <= m; ++ len) {
		for (int i = 1; i + len - 1 <= n; ++ i) {
			memset(buc, 0, sizeof buc);
			int j = i + len - 1, val = 0, major = 0;
			for (int k = i; k < j; ++ k) {
				ask(i, k), ask(k + 1, j);
				val = sum[i][k] + sum[k + 1][j];
				if (val <= j - i + 1) {
					++ buc[val];
					if (buc[major] < buc[val]) major = val;
				}
				if (buc[major] > 1) break;
			}
			real[i][j] = major;
		}
	}
	printf("! ");
	for (int i = 1; i <= n; ++ i) {
		if (i <= n - m + 1) printf("%d", adjust(real[i][i + m - 1] - real[i][i + m - 2]));
		else printf("%d", adjust(real[i - m + 1][i] - real[i - m + 2][i]));
	}
	puts("");
//	for(int i=1;i<=n;++i)printf("%d",a[i]-a[i-1]);
	fflush(stdout);
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 6ms
memory: 8664kb

input:

1
250
1
360
1
120
4
192
4
248
0
248
3
78
3
42
2
57
9
136
5
247
0
12
1
250
3
275
2
249
1
208
1
420
2
249
0
202
3
329
2
249
0
250
2
237
3
249
0
249
1
285
5
45
2
272
2
248
0
250
1
250
1
250
0
125
0
251
3
87
0
164
1
182
1
250
0
252
0
274
0
252
1
182
1
252
1
251
2
251
1
493
1
469
3
318
2
251
3
250
1
17
0...

output:

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

result:

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