# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44933 | nibnalin | 무제 (GCJ18Q_gogopher) | C++17 | 96 ms | 4276 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 <iostream>
#include <cstdio>
#include <vector>
#include <fstream>
using namespace std;
const int maxn = int(1e3)+5;
int marker[maxn][maxn], done = 0;
pair<int, int> ask(pair<int, int>& cen)
{
fflush(stdout), fflush(stdin);
pair<int, int> ret;
printf("%d %d\n", cen.first, cen.second);
fflush(stdout), fflush(stdin);
scanf("%d%d", &ret.first, &ret.second);
fflush(stdout), fflush(stdin);
if(ret.first == 0) done = 1;
else if(ret.first == -1) exit(17);
return ret;
}
bool rowdone(int r)
{
return (marker[r][1] && marker[r][2] && marker[r][3]);
}
void solve()
{
done = 0;
for(int i = 0;i < maxn;i++)
{
for(int j = 0;j < maxn;j++) marker[i][j] = 0;
}
pair<int, int> center = {2, 2};
int A, cur = 0;
fflush(stdout), fflush(stdin);
scanf("%d", &A);
fflush(stdout), fflush(stdin);
while(!done)
{
pair<int, int> col = ask(center);
cur += (!marker[col.first][col.second]);
marker[col.first][col.second] = 1;
if(rowdone(center.first-1) && cur < A) center.first++;
}
}
int main(void)
{
int t;
scanf("%d", &t);
while(t--) solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |