# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
140432 | silxikys | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
int ask(int r1, int c1, int r2, int c2) {
printf("%d %d %d %d\n",r1,c1,r2,c2);
fflush(stdout);
int res; cin >> res;
return res;
}
const int maxn = 105;
int g[maxn][maxn];
void recurse(int r1, int c1, int r2, int c2) {
int r = ask(r1,c1,r2,c2);
if (r == (r2-r1+1)*(c2-c1+1)) {
//all filled
for (int i = r1; i <= r2; i++) {
for (int j = c1; j <= c2; j++) {
g[i][j] = 1;
}
}
return;
}
else if (r == 0) {
return;
}
else {
if (r1 == r2) {
int m = (c1+c2)/2;
recurse(r1,c1,r2,m);
recurse(r1,m+1,r2,c2);
}
else {
int m = (r1+r2)/2;
recurse(r1,c1,m,c2);
recurse(m+1,c1,r2,c2);
}
}
}
int main()
{
cin >> N;
recurse(1,1,N,N);
cout << "END" << endl;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
cout << g[i][j];
}
cout << '\n';
}
}