Submission #260094

#TimeUsernameProblemLanguageResultExecution timeMemory
260094SamAndWombats (IOI13_wombats)C++17
55 / 100
20096 ms70292 KiB
#include "wombats.h" #include <bits/stdc++.h> using namespace std; #define m_p make_pair #define fi first #define se second #define sz(x) ((int)(x).size()) #define all(x) (x).begin(),(x).end() const int N = 5003, M = 202, INF = 1000000009; int n, m; int h[N][N], v[N][N]; int ans[M][M]; int dp[N][M]; void clc() { for (int f = 0; f < m; ++f) { for (int i = n - 1; i >= 0; --i) { if (i == n - 1) { for (int j = 0; j < m; ++j) { if (j == f) dp[i][j] = 0; else dp[i][j] = INF; } } else { for (int j = 0; j < m; ++j) { dp[i][j] = dp[i + 1][j] + v[i][j]; } } int minu = INF; for (int j = 0; j < m; ++j) { dp[i][j] = min(dp[i][j], minu); minu = min(minu, dp[i][j]); minu += h[i][j]; } minu = INF; for (int j = m - 1; j >= 0; --j) { dp[i][j] = min(dp[i][j], minu); minu = min(minu, dp[i][j]); if (j) minu += h[i][j - 1]; } } for (int s = 0; s < m; ++s) { ans[s][f] = dp[0][s]; } } } 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 - 1; ++j) { h[i][j] = H[i][j]; } } for (int i = 0; i < n - 1; ++i) { for (int j = 0; j < m; ++j) { v[i][j] = V[i][j]; } } clc(); } void changeH(int P, int Q, int W) { h[P][Q] = W; clc(); } void changeV(int P, int Q, int W) { v[P][Q] = W; clc(); } int escape(int V1, int V2) { return ans[V1][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]
  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...