Submission #1030067

# Submission time Handle Problem Language Result Execution time Memory
1030067 2024-07-21T19:12:57 Z vjudge1 Wombats (IOI13_wombats) C++17
28 / 100
20000 ms 16476 KB
#include "wombats.h"

#include <bits/stdc++.h>
using namespace std;

int n,c;
int h[5000][200],v[5000][200];
int dp[200][200],dpp[200][200];

void calc(){
    for(int i=0;i<c;i++){
        for(int j=0;j<c;j++){
            dp[i][j]=2e9;
        }
        dp[i][i]=0;
    }
    for(int i=1;i<c;i++){
        for(int j=0;j<i;j++){
            dp[i][j]=min(dp[i][j],dp[i-1][j]+h[n-1][i-1]);
        }
    }
    for(int i=c-2;0<=i;i--){
        for(int j=c-1;i<j;j--){
            dp[i][j]=min(dp[i][j],dp[i+1][j]+h[n-1][i]);
        }
    }
    for(int i=n-2;0<=i;i--){
        swap(dp,dpp);
        for(int j=0;j<c;j++){
            for(int k=0;k<c;k++){
                dp[j][k]=dpp[j][k]+v[i][j];
            }
        }
        for(int j=1;j<c;j++){
            for(int k=0;k<c;k++){
                dp[j][k]=min(dp[j][k],dp[j-1][k]+h[i][j-1]);
            }
        }
        for(int j=c-2;0<=j;j--){
            for(int k=0;k<c;k++){
                dp[j][k]=min(dp[j][k],dp[j+1][k]+h[i][j]);
            }
        }
    }
}

void init(int R, int C, int H[5000][200], int V[5000][200]) {
    n=R;
    c=C;
    for(int i=0;i<n;i++){
        for(int j=0;j<c;j++){
            h[i][j]=H[i][j];
            v[i][j]=V[i][j];
        }
    }
    calc();
}

void changeH(int P, int Q, int W) {
    h[P][Q]=W;
    calc();
}

void changeV(int P, int Q, int W) {
    v[P][Q]=W;
    calc();
}

int escape(int V1, int V2) {
    return dp[V1][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 Execution timed out 20050 ms 12380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 700 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 39 ms 3176 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 454 ms 1116 KB Output is correct
2 Correct 416 ms 1112 KB Output is correct
3 Correct 423 ms 1112 KB Output is correct
4 Correct 488 ms 1116 KB Output is correct
5 Correct 479 ms 1116 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 764 KB Output is correct
9 Correct 2258 ms 1116 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 20054 ms 16216 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 486 ms 1144 KB Output is correct
2 Correct 426 ms 1116 KB Output is correct
3 Correct 435 ms 1112 KB Output is correct
4 Correct 418 ms 1116 KB Output is correct
5 Correct 425 ms 1116 KB Output is correct
6 Execution timed out 20060 ms 16476 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 458 ms 1116 KB Output is correct
2 Correct 424 ms 1136 KB Output is correct
3 Correct 444 ms 1148 KB Output is correct
4 Correct 434 ms 1112 KB Output is correct
5 Correct 463 ms 1112 KB Output is correct
6 Execution timed out 20036 ms 16472 KB Time limit exceeded
7 Halted 0 ms 0 KB -