Submission #290703

#TimeUsernameProblemLanguageResultExecution timeMemory
290703Atill83Wombats (IOI13_wombats)C++14
55 / 100
20087 ms22088 KiB
#include "wombats.h" #include <bits/stdc++.h> using namespace std; long long dp[205][2][205]; int h[5000][200], v[5000][200]; int r, c; void clc(){ memset(dp, 0x7f, sizeof(dp)); for(int i = 0; i < c; i++){ dp[i][0][i] = 0; int bas = 1; for(int j = 0; j < r; j++){ if(!bas){ for(int k = 0; k < c; k++){ dp[i][j&1][k] = dp[i][j&1^1][k] + v[j - 1][k]; } } bas = 0; for(int k = 1; k < c; k++){ dp[i][j&1][k] = min(dp[i][j&1][k], dp[i][j&1][k - 1] + h[j][k - 1]); } for(int k = c - 2; k >= 0; k--){ dp[i][j&1][k] = min(dp[i][j&1][k], dp[i][j&1][k + 1] + h[j][k]); } } } } void init(int R, int C, int H[5000][200], int V[5000][200]) { r = R; c = C; for(int i = 0; i < R; i++){ for(int j = 0; j < C; j++){ if(i != R - 1) v[i][j] = V[i][j]; if(j != C - 1) h[i][j] = H[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 dp[V1][(r - 1)%2][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 clc()':
wombats.cpp:15:44: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   15 |                     dp[i][j&1][k] = dp[i][j&1^1][k] + v[j - 1][k];
      |                                           ~^~
#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...