Submission #249929

#TimeUsernameProblemLanguageResultExecution timeMemory
249929MarcoMeijerWombats (IOI13_wombats)C++14
55 / 100
20073 ms30328 KiB
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;

//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
#define sz size()

const int MX = 6000;
int r, c;
int h[MX][210], v[MX][210];
int dp[MX][210];

void init(int R, int C, int H[5000][200], int V[5000][200]) {
    r=R, c=C;
    RE(i,r) RE(j,c) h[i][j]=H[i][j]; 
    RE(i,r) RE(j,c) v[i][j]=V[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;
}

int escape(int V1, int V2) {
    dp[0][V1] = 0;

    int tot=0;
    REP(j,V1+1,c) tot+=h[0][j-1], dp[0][j] = tot;

    tot=0;
    REV(j,0,V1) tot+=h[0][j], dp[0][j] = tot;

    REP(i,1,r) {
        RE(j,c) {
            dp[i][j] = dp[i-1][j]+v[i-1][j];

            tot = 0;
            REP(k,j+1,c) tot+=h[i][k-1], dp[i][j] = min(dp[i][j], dp[i-1][k]+tot+v[i-1][k]);

            tot = 0;
            REV(k,0,j) tot+=h[i][k], dp[i][j] = min(dp[i][j], dp[i-1][k]+tot+v[i-1][k]);
        }
    }

    return dp[r-1][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]
  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...