Submission #117468

#TimeUsernameProblemLanguageResultExecution timeMemory
117468tjd229산악 구조대 (JOI13_mountain)C++14
0 / 100
13 ms896 KiB
#include "grader.h" #include <vector> #define pii pair<int,int> using namespace std; vector<pii > g[401]; int md(int r1,int c1,int r2,int c2) { int dr = r1 - r2; int dc = c1 - c2; if (dr < 0) dr = -dr; if (dc < 0) dc = -dc; return dr + dc; } void Rescue(int R, int C, int RS, int CS, int X) { int i, j; int l = 0, r = 0; int lb = 0, ub = 0; for (i = 1; i <= R; ++i) { for (j = 1; j <= C; ++j) { int d = md(RS, CS, i, j); if (r < d) r = d; g[d].push_back({i,j}); } } while (l <= r) { int m = (l + r) >> 1; int RM = g[m][0].first; int CM = g[m][0].second; int h = Measure(RM,CM); if (h == X) { Pinpoint(RM,CM); return; } else if (h > X) lb = m, l = m + 1; else ub = m, r = m - 1; } for (i = 1; i < g[lb].size(); ++i) { int RM = g[lb][i].first; int CM = g[lb][i].second; if (Measure(RM, CM) == X) { Pinpoint(RM, CM); return; } } for (i = 1; i < g[ub].size(); ++i) { int RM = g[ub][i].first; int CM = g[ub][i].second; if (Measure(RM, CM) == X) { Pinpoint(RM, CM); return; } } }

Compilation message (stderr)

mountain.cpp: In function 'void Rescue(int, int, int, int, int)':
mountain.cpp:36:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 1; i < g[lb].size(); ++i) {
              ~~^~~~~~~~~~~~~~
mountain.cpp:44:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 1; i < g[ub].size(); ++i) {
              ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...