Submission #383550

#TimeUsernameProblemLanguageResultExecution timeMemory
383550alireza_kavianiWombats (IOI13_wombats)C++11
55 / 100
4552 ms29804 KiB
#include <bits/stdc++.h> #include "wombats.h" using namespace std; const int MAXN = 5010; const int MAXC = 300; const int MOD = 1e9 + 7; int n , m , h[MAXN][MAXC] , v[MAXN][MAXC] , dp[MAXC][MAXC]; void solve(){ if(n * m * m >= int(2e6)) return; for(int i = 0 ; i < m ; i++){ fill(dp[i] , dp[i] + MAXC , MOD); dp[i][i] = 0; for(int j = 0 ; j < n ; j++){ if(j) for(int k = 0 ; k < m ; k++) dp[i][k] += v[j - 1][k]; for(int k = 1 ; k < m ; k++){ dp[i][k] = min(dp[i][k] , dp[i][k - 1] + h[j][k - 1]); } for(int k = m - 2 ; k >= 0 ; k--){ dp[i][k] = min(dp[i][k] , dp[i][k + 1] + h[j][k]); } } } } void init(int R, int C, int H[5000][200], int V[5000][200]) { /* ... */ int sum = 0; n = R; m = C; for(int i = 0 ; i < 5000 ; i++){ for(int j = 0 ; j < 200 ; j++){ h[i][j] = H[i][j]; v[i][j] = V[i][j]; } } solve(); } void changeH(int P, int Q, int W) { h[P][Q] = W; solve(); } void changeV(int P, int Q, int W) { v[P][Q] = W; solve(); } int escape(int V1, int V2) { return dp[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]
   15 |  int res;
      |      ^~~
wombats.cpp: In function 'void init(int, int, int (*)[200], int (*)[200])':
wombats.cpp:30:6: warning: unused variable 'sum' [-Wunused-variable]
   30 |  int sum = 0;
      |      ^~~
#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...