Submission #372672

#TimeUsernameProblemLanguageResultExecution timeMemory
372672two_sides산악 구조대 (JOI13_mountain)C++17
0 / 100
9 ms492 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; void Rescue(int r, int c, int rs, int cs, int x) { int lim = max({rs + cs - 2, rs - 1 + c - cs, r - rs + cs - 1, r - rs + c - cs}); auto getRand = [&](int d) { if (d < 0) return INT_MAX; if (d > lim) return INT_MIN; for (int i = 1; i <= r; i++) for (int j = 1; j <= c; j++) if (abs(i - rs) + abs(j - cs) == d) return Measure(i, j); }; int curd; for (int i = lim; i > 0; i--) if (getRand(i + 1) < x) curd = i; else break; int ma = INT_MIN; for (int i = 1; i <= r; i++) for (int j = 1; j <= c; j++) if (abs(i - rs) + abs(j - rs) == curd) { int val = Measure(i, j); if (val == x) { Pinpoint(i, j); return; } ma = max(ma, val); } if (ma < x) curd--; else curd++; for (int i = 1; i <= r; i++) for (int j = 1; j <= c; j++) if (abs(i - rs) + abs(j - rs) == curd) { int val = Measure(i, j); if (val == x) { Pinpoint(i, j); return; } } }

Compilation message (stderr)

mountain.cpp: In lambda function:
mountain.cpp:16:5: warning: control reaches end of non-void function [-Wreturn-type]
   16 |     };
      |     ^
mountain.cpp: In function 'void Rescue(int, int, int, int, int)':
mountain.cpp:31:34: warning: 'curd' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |     if (ma < x) curd--; else curd++;
      |                              ~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...