Submission #962234

#TimeUsernameProblemLanguageResultExecution timeMemory
962234serkanrashidWombats (IOI13_wombats)C++14
55 / 100
20026 ms32400 KiB
#include "wombats.h" #include <bits/stdc++.h> using namespace std; int r,c; int h[5000][200],v[5000][200]; unsigned int inf = -1; long long d[5000][200]; int sum; void changeH(int P, int Q, int W) { h[P][Q] = W; } void changeV(int P, int Q, int W) { sum -= v[P][Q]; v[P][Q] = W; sum += W; } int escape(int V1, int V2) { if(c==1) return sum; for(int i = 0; i < r; i++) { for(int j = 0; j < c; j++) d[i][j] = inf; } d[0][V1] = 0; for(int i = 0; i < r-1; i++) { for(int j = 1; j < c; j++) d[i][j] = min(d[i][j],d[i][j-1]+h[i][j-1]); for(int j = c-2; j >= 0; j--) d[i][j] = min(d[i][j],d[i][j+1]+h[i][j]); for(int j = 0; j < c; j++) d[i+1][j] = min(d[i+1][j],d[i][j]+v[i][j]); } int i = r-1; for(int j = 1; j < c; j++) d[i][j] = min(d[i][j],d[i][j-1]+h[i][j-1]); for(int j = c-2; j >= 0; j--) d[i][j] = min(d[i][j],d[i][j+1]+h[i][j]); int pom = d[r-1][V2]; return pom; } 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-1;j++) h[i][j] = H[i][j]; for(int i=0;i<R-1;i++) for(int j=0;j<C;j++) { v[i][j] = V[i][j]; sum += v[i][j]; } }

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...