QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#263309#7833. Binary StringzqsWA 15ms6096kbC++141003b2023-11-24 18:42:582023-11-24 18:42:59

Judging History

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

  • [2023-11-24 18:42:59]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:6096kb
  • [2023-11-24 18:42:58]
  • 提交

answer

#include <cstdio>
#include <cstring>

int sum[1005][1005], real[1005][1005], buc[1005], n = 1000, m = 500;
bool vis[1005][1005];
inline bool ask(int l, int r) {
	if (!vis[l][r]) {
		printf("? %d %d\n", l, r);
		fflush(stdout);
		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;
			for (int k = i; k < j && k <= i + 16; ++ k) {
				ask(i, k), ask(k + 1, j);
				if (sum[i][k] + sum[k + 1][j] <= j - i + 1) ++ buc[sum[i][k] + sum[k + 1][j]];
			}
			int major = 0;
			for (int k = 1; k <= j - i + 1; ++ k) if (buc[k] > buc[major]) major = k;
			real[i][j] = major;
		}
	}
	printf("! ");
	for (int i = 1; i <= n; ++ i)
		if (i <= n - m + 1) printf("%d", real[i][i + m] - real[i][i + m - 2]);
		else printf("%d", real[i - m + 1][i] - real[i - m + 2][i]);
	puts("");
	fflush(stdout);
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 15ms
memory: 6096kb

input:

1
250
1
360
1
120
4
192
4
248
0
248
3
78
3
42
2
57
9
136
5
247
4
448
5
246
14
385
6
245
7
420
8
324
0
251
2
150
3
140
2
249
2
262
2
249
1
243
2
431
3
248
10
411
2
329
4
247
11
70
14
246
6
245
7
244
8
129
1
250
0
374
2
93
2
467
2
249
2
249
2
108
3
248
6
248
3
245
4
301
5
246
5
471
6
214
7
244
5
100
1...

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
? 1 12
? 13 499
? 1 13
? 14 499
? 1 14
? 15 499
? 1 15
? 16 499
? 1 16
? 17 499
? 1 17
? 18 499
? 2 2
? 3 500
? 2 3
? 4 500
? 2 4
? 5 500
? 2...

result:

wrong output format Unexpected end of file - token expected