Submission #962138

#TimeUsernameProblemLanguageResultExecution timeMemory
962138danikoynovWombats (IOI13_wombats)C++14
28 / 100
3934 ms169028 KiB
#include "wombats.h" #include<bits/stdc++.h> using namespace std; const int maxr = 2010, maxc = 210; void precalculate(); int h[maxr][maxc], v[maxr][maxc], dp[maxc][maxr][maxc]; int r, c; void init(int R, int C, int H[5000][200], int V[5000][200]) { /* ... */ r = R; c = C; for (int i = 0; i < R - 1; i ++) for (int j = 0; j < C; j ++) v[i][j] = V[i][j]; for (int i = 0; i < R; i ++) for (int j = 0; j < C - 1; j ++) h[i][j] = H[i][j]; precalculate(); } const int inf = 2e9 + 10; void fix_row(int d, int i) { for (int j = 1; j < c; j ++) { dp[d][i][j] = min(dp[d][i][j], dp[d][i][j - 1] + h[i][j - 1]); } for (int j = c - 2; j >= 0; j --) { dp[d][i][j] = min(dp[d][i][j], dp[d][i][j + 1] + h[i][j]); } } void calc_dp(int d) { for (int i = 0; i < r;i ++) for (int j = 0; j < c; j ++) dp[d][i][j] = inf; dp[d][0][d] = 0; fix_row(d, 0); for (int i = 1; i < r; i ++) { for (int j = 0; j < c; j ++) { dp[d][i][j] = dp[d][i - 1][j] + v[i - 1][j]; } fix_row(d, i); } } void precalculate() { for (int d = 0; d < c; d ++) calc_dp(d); } void changeH(int P, int Q, int W) { /* ... */ h[P][Q] = W; precalculate(); } void changeV(int P, int Q, int W) { /* ... */ v[P][Q] = W; precalculate(); } int escape(int V1, int V2) { return dp[V1][r - 1][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;
      |      ^~~
wombats.cpp: In function 'void init(int, int, int (*)[200], int (*)[200])':
wombats.cpp:19:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   19 |     for (int i = 0; i < R; i ++)
      |     ^~~
wombats.cpp:23:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   23 |      precalculate();
      |      ^~~~~~~~~~~~
#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...