제출 #168069

#제출 시각아이디문제언어결과실행 시간메모리
168069davitmarg웜뱃 (IOI13_wombats)C++17
28 / 100
20085 ms24972 KiB
/*DavitMarg*/ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <unordered_map> #include <set> #include <queue> #include <iomanip> #include <bitset> #include <stack> #include <cassert> #include <iterator> #include <fstream> #define mod 1000000009ll #define LL long long #define LD long double #define MP make_pair #define PB push_back #define all(v) v.begin(), v.end() using namespace std; const int N = 5005; #ifndef death #include "wombats.h" #endif int n, m, used[5005][202]; int d[5005][202], h[5005][202], v[5005][202]; void djikstra(int v2) { for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { d[i][j] = mod; used[i][j] = 0; } priority_queue<pair<int, pair<int, int>>> q; d[n - 1][v2] = 0; q.push(MP(0, MP(n - 1, v2))); while (!q.empty()) { int y = -1, x = -1; do { y = q.top().second.first; x = q.top().second.second; q.pop(); } while (used[y][x] && !q.empty()); if (y == -1 || used[y][x]) break; used[y][x] = 1; int Y, X; Y = y - 1; X = x; if (y > 0 && d[Y][X] > d[y][x] + v[Y][X]) { d[Y][X] = d[y][x] + v[Y][X]; q.push(MP(-d[Y][X], MP(Y, X))); } Y = y; X = x + 1; if (x < m - 1 && d[Y][X] > d[y][x] + h[y][x]) { d[Y][X] = d[y][x] + h[y][x]; q.push(MP(-d[Y][X], MP(Y, X))); } Y = y; X = x - 1; if (x > 0 && d[Y][X] > d[y][x] + h[Y][X]) { d[Y][X] = d[y][x] + h[Y][X]; q.push(MP(-d[Y][X], MP(Y, X))); } } } void changeH(int P, int Q, int W) { h[P][Q] = W; } void changeV(int P, int Q, int W) { v[P][Q] = W; } int escape(int v1, int v2) { if (m != 1) djikstra(v2); return d[0][v1]; } void init(int R, int C, int H[5000][200], int V[5000][200]) { n = R; m = C; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { h[i][j] = H[i][j]; v[i][j] = V[i][j]; } if (m == 1) djikstra(0); } #ifdef death int main() { int N, M, H[5000][200], V[5000][200], Q; cin >> N >> M; for (int i = 0; i < N; i++) for (int j = 0; j < M - 1; j++) cin >> H[i][j]; for (int i = 0; i < N - 1; i++) for (int j = 0; j < M; j++) cin >> V[i][j]; init(N, M, H, V); cin >> Q; while (Q--) { int T, Y, X, W; cin >> T >> Y >> X; if (T == 3) { cout << "!!!"; cout << escape(Y, X) << endl; continue; } cin >> W; if (T == 1) changeH(Y, X, W); else changeV(Y, X, W); } return 0; } #endif /* 3 4 0 2 5 7 1 1 0 4 0 0 0 0 2 0 3 4 7 5 3 2 1 3 3 3 2 0 0 5 1 1 1 6 3 2 1 */

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

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
#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...