QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263313#7833. Binary StringzqsWA 0ms6200kbC++141006b2023-11-24 18:45:192023-11-24 18:45:21

Judging History

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

  • [2023-11-24 18:45:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:6200kb
  • [2023-11-24 18:45:19]
  • 提交

answer

#include <cstdio>
#include <iostream>
#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]) {
		std::cout<<"? "<<l+1<<' '<<r<<std::endl;
		std::cin>>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;
		}
	}
	std::cout<<"! ";
	for (int i = 1; i <= n; ++ i)
		if (i <= n - m + 1) std::cout<<real[i][i + m] - real[i][i + m - 2];
		else std::cout<<real[i - m + 1][i] - real[i - m + 2][i];
	std::cout<<std::endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:


output:

? 2 1

result:

wrong output format Unexpected end of file - token expected