제출 #372691

#제출 시각아이디문제언어결과실행 시간메모리
372691hoanghq2004산악 구조대 (JOI13_mountain)C++14
0 / 100
9 ms2540 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; void Rescue(int n, int m, int RS, int CS, int X) { map <int, vector <pair <int, int> > > mp; vector <pair <int, int> > block[(n + 10) * (m + 10)]; vector <vector <int> > height(n + 10, vector <int> (m + 10, -1)); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { mp[abs(i - RS) + abs(j - CS)].push_back({i, j}); } } int sz = 0; for (auto [id, vcell]: mp) block[sz++] = vcell; auto ask = [&](int i, int j) { if (height[i][j] != -1) return height[i][j]; height[i][j] = Measure(i, j); if (height[i][j] == X) Pinpoint(i, j); return height[i][j]; }; int L = 0, R = sz - 1; while (R - L > 1) { int mid = L + R >> 1; if (ask(block[mid].front().first, block[mid].front().second) < X) R = mid; else L = mid; } for (auto [i, j]: block[L]) ask(i, j); for (auto [i, j]: block[R]) ask(i, j); }

컴파일 시 표준 에러 (stderr) 메시지

mountain.cpp: In function 'void Rescue(int, int, int, int, int)':
mountain.cpp:16:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   16 |     for (auto [id, vcell]: mp) block[sz++] = vcell;
      |               ^
mountain.cpp:25:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   25 |         int mid = L + R >> 1;
      |                   ~~^~~
mountain.cpp:29:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   29 |     for (auto [i, j]: block[L]) ask(i, j);
      |               ^
mountain.cpp:30:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   30 |     for (auto [i, j]: block[R]) ask(i, j);
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...