Submission #294008

#TimeUsernameProblemLanguageResultExecution timeMemory
294008AaronNaiduAliens (IOI07_aliens)C++14
0 / 100
3072 ms256 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, x, y; int main() { cin >> n >> x >> y; ll squareLeft = x; ll squareRight = x; ll squareTop = y; ll squareBottom = y; string s; while (squareLeft > 1) { squareLeft--; cout << "examine " << squareLeft << " " << y << "\n"; fflush(stdout); cin >> s; if (s == "false") { squareLeft++; break; } } while (squareRight < n) { squareRight++; cout << "examine " << squareRight << " " << y << "\n"; fflush(stdout); cin >> s; if (s == "false") { squareRight--; break; } } while (squareBottom > 1) { squareBottom--; cout << "examine " << squareBottom << " " << y << "\n"; fflush(stdout); cin >> s; if (s == "false") { squareBottom++; break; } } while (squareTop < n) { squareTop++; cout << "examine " << squareTop << " " << y << "\n"; fflush(stdout); cin >> s; if (s == "false") { squareTop--; break; } } ll centreX = (squareLeft + squareRight)/2; ll centreY = (squareBottom + squareTop)/2; ll sideLength = squareRight - squareLeft + 1; ll rowAdj = 0; ll colAdj = 0; bool twoPlus, onePlus, oneMinus, twoMinus; twoPlus = onePlus = oneMinus = twoMinus = false; if (centreX + 4 * sideLength <= n) { cout << "examine " << centreX + 4 * sideLength << " " << centreY << "\n"; fflush(stdout); cin >> s; if (s == "true") { twoPlus = true; } } if (centreX + 2 * sideLength <= n) { cout << "examine " << centreX + 2 * sideLength << " " << centreY << "\n"; fflush(stdout); cin >> s; if (s == "true") { onePlus = true; } } if (centreX - 2 * sideLength >= 1) { cout << "examine " << centreX - 2 * sideLength << " " << centreY << "\n"; fflush(stdout); cin >> s; if (s == "true") { oneMinus = true; } } if (centreX - 4 * sideLength >= 1) { cout << "examine " << centreX - 4 * sideLength << " " << centreY << "\n"; fflush(stdout); cin >> s; if (s == "true") { twoMinus = true; } } if (twoPlus) { colAdj = 2; } else if (twoMinus) { colAdj = -2; } else if (onePlus and oneMinus) { colAdj = 0; } else if (onePlus) { colAdj = 1; } else { colAdj = -1; } twoPlus = onePlus = oneMinus = twoMinus = false; if (centreY + 4 * sideLength <= n) { cout << "examine " << centreX << " " << centreY + 4 * sideLength << "\n"; fflush(stdout); cin >> s; if (s == "true") { twoPlus = true; } } if (centreY + 2 * sideLength <= n) { cout << "examine " << centreX << " " << centreY + 2 * sideLength << "\n"; fflush(stdout); cin >> s; if (s == "true") { onePlus = true; } } if (centreY - 2 * sideLength >= 1) { cout << "examine " << centreX << " " << centreY - 2 * sideLength << "\n"; fflush(stdout); cin >> s; if (s == "true") { oneMinus = true; } } if (centreY - 4 * sideLength >= 1) { cout << "examine " << centreX << " " << centreY - 4 * sideLength << "\n"; fflush(stdout); cin >> s; if (s == "true") { twoMinus = true; } } if (twoPlus) { rowAdj = 2; } else if (twoMinus) { rowAdj = -2; } else if (onePlus and oneMinus) { rowAdj = 0; } else if (onePlus) { rowAdj = 1; } else { rowAdj = -1; } centreY += rowAdj * sideLength; centreX += colAdj * sideLength; cout << "solution " << centreX << " " << centreY << "\n"; fflush(stdout); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...