Submission #372687

#TimeUsernameProblemLanguageResultExecution timeMemory
372687ngpin04산악 구조대 (JOI13_mountain)C++14
0 / 100
8 ms492 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int N = 205; int target,r,c; bool ask(int x, int y) { if (min(x, y) == 0 || x > r || y > c) return false; int val = Measure(x, y); if (val == target) { Pinpoint(x, y); exit(0); } return val > target; } void Rescue(int n, int m, int rs, int cs, int x) { r = n; c = m; target = x; int i,j; /** right */ i = rs, j = cs; while (ask(i, j + 1)) j++; while (true) { bool found = false; if (ask(i - 1, j)) { found = true; i--; } else if (j - 1 > cs) { found = true; if (ask(i - 1, j - 1)) i--; j--; } if (!found) break; } /** top */ i = rs, j = cs; while (ask(i - 1, j)) i--; while (true) { bool found = false; if (ask(i, j - 1)) { found = true; j--; } else if (i + 1 < rs) { found = true; if (ask(i + 1, j - 1)) i++; j--; } if (!found) break; } /** left */ i = rs, j = cs; while (ask(i, j - 1)) j--; while (true) { bool found = false; if (ask(i + 1, j)) { found = true; i++; } else if (j + 1 < cs) { found = true; if (ask(i + 1, j + 1)) i++; j++; } if (!found) break; } /** bot */ i = rs, j = cs; while (ask(i + 1, j)) i++; while (true) { bool found = false; if (ask(i, j + 1)) { found = true; j++; } else if (i - 1 > rs) { found = true; if (ask(i - 1, j + 1)) i--; j++; } if (!found) break; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...