QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263319#7833. Binary StringzqsWA 0ms8636kbC++141000b2023-11-24 18:50:322023-11-24 18:50:33

Judging History

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

  • [2023-11-24 18:50:33]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:8636kb
  • [2023-11-24 18:50:32]
  • 提交

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 + 6; ++ 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 - 1] - real[i][i + m - 2]);
		else printf("%d", real[i - m + 1][i] - real[i - m + 2][i]);
	}
	fflush(stdout);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 8636kb

input:

1
250
1
360
1
120
4
192
4
248
0
248
3
78
0
472
0
207
0
305
2
249
4
249
2
237
3
249
1
250
2
420
2
249
0
202
3
329
2
249
2
249
1
250
1
237
3
249
0
249
1
285
5
45
2
272
1
250
0
183
0
250
1
250
1
250
2
74
2
249
1
359
0
134
0
8
0
251
1
250
1
208
1
250
1
182
1
252
0
252
2
251
4
251
1
447
0
48
1
164
1
252
...

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
? 2 2
? 3 500
? 2 3
? 4 500
? 2 4
? 5 500
? 2 5
? 6 500
? 2 6
? 7 500
? 2 7
? 8 500
? 2 8
? 9 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
? 3 9
? 10 501
? 4 4...

result:

wrong output format Unexpected end of file - token expected