Submission #263252

#TimeUsernameProblemLanguageResultExecution timeMemory
263252eohomegrownappsWombats (IOI13_wombats)C++14
55 / 100
20066 ms18040 KiB
#include "wombats.h" #include <bits/stdc++.h> using namespace std; int (*h)[200]; int (*v)[200]; int r,c; //r: height c: width int INF = 1e9; void init(int R, int C, int H[5000][200], int V[5000][200]) { /* ... */ h=H;v=V; r=R;c=C; } void changeH(int P, int Q, int W) { /* ... */ h[P][Q]=W; } void changeV(int P, int Q, int W) { /* ... */ v[P][Q]=W; } int harr[2][5000]; int prefsum[5000]; int escape(int vtop, int vbot) { for (int i = 0; i<c; i++){ harr[0][i]=INF; } harr[0][vtop]=0; bool cur = 1; for (int y = 1; y<=r; y++){ //process row h[y-1][x] and v[y-1][x] prefsum[0]=0; for (int x = 0; x<c-1; x++){ prefsum[x+1]=prefsum[x]+h[y-1][x]; } int minval = INF; for (int x = c-1; x>=0; x--){ int vert = (y==r)?0:v[y-1][x]; //cout<<prefsum[x]<<' '; minval=min(minval,prefsum[x]+harr[!cur][x]); harr[cur][x]=minval-prefsum[x]+vert; }//cout<<'\n'; prefsum[c-1]=0; for (int x = c-2; x>=0; x--){ prefsum[x]=prefsum[x+1]+h[y-1][x]; } minval = INF; for (int x = 0; x<c; x++){ int vert = (y==r)?0:v[y-1][x]; minval=min(minval,prefsum[x]+harr[!cur][x]); harr[cur][x]=min(harr[cur][x],minval-prefsum[x]+vert); } /*for (int i = 0; i<c; i++){ cout<<harr[cur][i]<<' '; }cout<<'\n';*/ cur=!cur; } return harr[!cur][vbot]; }

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