Submission #168052

#TimeUsernameProblemLanguageResultExecution timeMemory
168052davitmargWombats (IOI13_wombats)C++17
0 / 100
20097 ms31864 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]; LL d[5005][202], h[5005][202], v[5005][202]; void djikstra() { for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) d[i][j] = mod * mod; priority_queue<pair<LL, pair<int, int>>> q; for (int j = 0; j < m; j++) { d[n - 1][j] = 0; q.push(MP(0, MP(n - 1, j))); } while (!q.empty()) { int y = -1, x = -1; do { y = q.top().second.first; x = q.top().second.second; } 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 (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 (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 (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; djikstra(); } void changeV(int P, int Q, int W) { v[P][Q] = W; djikstra(); } int escape(int y, int x) { return d[y][x]; } 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]; } djikstra(); } #ifdef death int main() { return 0; } #endif /* */

Compilation message (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...