QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#263312 | #7833. Binary String | zqs | WA | 3ms | 6068kb | C++14 | 1.0kb | 2023-11-24 18:44:50 | 2023-11-24 18:44:50 |
Judging History
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;
fflush(stdout);
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: 3ms
memory: 6068kb
input:
output:
? 2 1
result:
wrong output format Unexpected end of file - token expected