Submission #575781

# Submission time Handle Problem Language Result Execution time Memory
575781 2022-06-11T09:11:07 Z enerelt14 Wombats (IOI13_wombats) C++14
9 / 100
7525 ms 262144 KB
#include "wombats.h"
#include<bits/stdc++.h>
using namespace std;
int r, c, h[5000][200], v[5000][200];
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];
        }
    }
}

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 solve(int r1, int c1, int r2, int c2){
    int ans=0;
    if (r1==r2){
        for (int i=min(c1, c2);i<max(c1, c2);i++)ans+=h[r1][i];
        return ans;
    }
    ans=solve(r1+1, c1, r2, c2)+v[r1][c1];
    if (c1>0)ans=min(ans, solve(r1, c1-1, r2, c2)+h[r1][c1-1]);
    if (c1<c-1)ans=min(ans, solve(r1, c1+1, r2, c2)+h[r1][c1]);
    return ans;
}
int escape(int V1, int V2) {
    return solve(0, V1, r-1, V2);
}

Compilation message

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 time Memory Grader output
1 Correct 20 ms 8532 KB Output is correct
2 Correct 22 ms 8532 KB Output is correct
3 Correct 7525 ms 10424 KB Output is correct
4 Correct 19 ms 8532 KB Output is correct
5 Correct 19 ms 8532 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Runtime error 127 ms 262144 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 233 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 125 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 223 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 221 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -