Submission #44947

#TimeUsernameProblemLanguageResultExecution timeMemory
44947JustInCaseUntitled (GCJ18Q_gogopher)C++17
30 / 30
101 ms1336 KiB
#include <bits/stdc++.h> using namespace std; bool isMarked[1000][1000]; int main() { int32_t cntTests; cin >> cntTests; for(int32_t cs = 1; cs <= cntTests; cs++) { int32_t a; cin >> a; memset(isMarked, 0, sizeof(isMarked)); int32_t currRow = 10, currCol = 10, cntMarked = 0, cnt = 0; while(1) { cnt++; cout << currRow << " " << currCol << endl << flush; int32_t x, y; cin >> x >> y; if(x == 0 && y == 0) { break; } else if(x == -1 && y == -1) { return 0; } if(!isMarked[x][y]) { isMarked[x][y] = true; cntMarked++; } bool isReady = true; for(int32_t r = currRow - 1; r <= currRow + 1; r++) { for(int32_t c = currCol - 1; c <= currCol; c++) { if(!isMarked[r][c]) { isReady = false; break; } } } if(isReady) { int32_t rem = 0; if(!isMarked[x - 1][y + 1]) { rem++; } if(!isMarked[x][y + 1]) { rem++; } if(!isMarked[x + 1][y + 1]) { rem++; } if(rem < a - cntMarked) { currCol++; } } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...