Submission #1074037

#TimeUsernameProblemLanguageResultExecution timeMemory
1074037IgnutWombats (IOI13_wombats)C++17
21 / 100
2441 ms9052 KiB
// Ignut #include <bits/stdc++.h> #include "wombats.h" using namespace std; using ll = long long; // const int H = 5555, W = 222; int h, w; vector<vector<int>> dwn, rht; vector<vector<int>> pref; void init(int R, int C, int H[5000][200], int V[5000][200]) { h = R, w = C; dwn.assign(h, {}); rht.assign(h, {}); pref.assign(h, {}); for (int i = 0; i < h - 1; i ++) for (int j = 0; j < w; j ++) dwn[i].push_back(V[i][j]); for (int i = 0; i < h; i ++) { pref[i].push_back(0); for (int j = 0; j < w - 1; j ++) { rht[i].push_back(H[i][j]); pref[i].push_back(pref[i].back() + H[i][j]); } } } void changeH(int P, int Q, int W) { rht[P][Q] = w; pref[P] = {0}; for (int j = 0; j < w - 1; j ++) pref[P].push_back(pref[P].back() + rht[P][j]); } void changeV(int P, int Q, int W) { dwn[P][Q] = W; } const int INF = 1e9 + 123; int escape(int V1, int V2) { vector<int> dist(w, INF); dist[V1] = 0; for (int i = 0; i < h; i ++) { for (int j1 = 0; j1 < w; j1 ++) { for (int j2 = 0; j2 < w; j2 ++) { dist[j1] = min(dist[j1], dist[j2] + abs(pref[i][j1] - pref[i][j2])); } } if (i + 1 < h) for (int j = 0; j < w; j ++) dist[j] += dwn[i][j]; } return dist[V2]; }

Compilation message (stderr)

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