Submission #1028876

#TimeUsernameProblemLanguageResultExecution timeMemory
1028876tolbiWombats (IOI13_wombats)C++17
55 / 100
20103 ms35344 KiB
#include "wombats.h" #include <bits/stdc++.h> using namespace std; const int MAXR = 5000; const int MAXC = 200; typedef long long ll; const ll INF = 1e15; ll H[MAXR][MAXC]={},V[MAXR][MAXC]={}; int C,R; void init(int RR, int CC, int HH[5000][200], int VV[5000][200]) { C=CC,R=RR; for (int i = 0; i < R; i++){ for (int j = 0; j < C; j++){ if (j+1<C) H[i][j]=HH[i][j]; if (i+1<R) V[i][j]=VV[i][j]; } } } void changeH(int P, int Q, int W) { H[P][Q]=W; } void changeV(int P, int Q, int W) { V[P][Q]=W; } ll ans[MAXR][MAXC]; ll nans[MAXR][MAXC]; ll cur[MAXR][MAXC]; int opt[MAXR][MAXC]; int escape(int V1, int V2) { for (int i = 0; i < C; i++){ for (int j = 0; j < C; j++){ if (i==j) ans[i][j]=0; else ans[i][j]=INF; } } for (int x = 0; x < R; x++){ for (int i = 0; i < C; i++){ ll somma = 0; for (int j = i; j < C; j++){ cur[i][j]=somma+V[x][j]; somma+=H[x][j]; } somma=0; for (int j = i-1; j >= 0; j--){ somma+=H[x][j]; cur[i][j]=somma+V[x][j]; } } for (int i = C-1; i >= 0; i--){ for (int j = 0; j < C; j++){ int lbound = 0; if (j) lbound = opt[i][j-1]; int rbound = C-1; if (i+1<C) rbound = opt[i+1][j]; nans[i][j]=ans[i][lbound]+cur[lbound][j]; opt[i][j]=lbound; for (int k = lbound; k <= rbound; k++){ if (ans[i][k]+cur[k][j]<nans[i][j]){ nans[i][j]=ans[i][k]+cur[k][j]; opt[i][j]=k; } } } } for (int i = 0; i < C; i++){ for (int j = 0; j < C; j++){ ans[i][j]=nans[i][j]; } } } 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]
   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...