Submission #767416

# Submission time Handle Problem Language Result Execution time Memory
767416 2023-06-26T18:17:20 Z Ahmed57 Wombats (IOI13_wombats) C++17
55 / 100
20000 ms 20916 KB
#include "wombats.h"
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[5001][201];
int b[5001][201];
int calc[5001][201];
void init(int R,int C,int H[5000][200],int V[5000][200]){
    n = R , m = C;
    for(int i = 0;i<n;i++){
        for(int j = 0;j<m-1;j++){
            a[i][j] = H[i][j];
        }
    }
    for(int i = 0;i<n-1;i++){
        for(int j = 0;j<m;j++){
            b[i][j] = V[i][j];
        }
    }
}
void changeH(int P,int Q,int W){
    a[P][Q] = W;
}
void changeV(int P,int Q,int W){
    b[P][Q] = W;
}
int escape(int V1,int V2){
    for(int i = 0;i<n;i++){
        for(int j = 0;j<m;j++){
            calc[i][j] = 1e9;
        }
    }
    calc[0][V1] = 0;
    for(int i = 0;i<n;i++){
        if(i){
            for(int j = 0;j<m;j++){
                calc[i][j] = calc[i-1][j]+b[i-1][j];
            }
        }
        vector<int> lol1(m,0);
        int mi = 1e9;
        for(int j = 0;j<m;j++){
            if(j){
                mi+=a[i][j-1];
            }
            mi = min(mi,calc[i][j]);
            lol1[j] = mi;
        }
        mi = 1e9;
        for(int j = m-1;j>=0;j--){
            if(j<m-1){
                mi+=a[i][j];
            }
            mi = min(mi,calc[i][j]);
            calc[i][j] = min(lol1[j],mi);
        }
    }
    return calc[n-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 49 ms 12040 KB Output is correct
2 Correct 48 ms 12108 KB Output is correct
3 Correct 17534 ms 13876 KB Output is correct
4 Correct 51 ms 12116 KB Output is correct
5 Correct 50 ms 12108 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 308 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 318 ms 1488 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 808 KB Output is correct
2 Correct 5 ms 684 KB Output is correct
3 Correct 7 ms 700 KB Output is correct
4 Correct 7 ms 816 KB Output is correct
5 Correct 7 ms 808 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 5 ms 724 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 135 ms 19980 KB Output is correct
2 Correct 118 ms 19972 KB Output is correct
3 Correct 137 ms 19996 KB Output is correct
4 Correct 12321 ms 20872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 724 KB Output is correct
2 Correct 5 ms 724 KB Output is correct
3 Correct 7 ms 724 KB Output is correct
4 Correct 7 ms 780 KB Output is correct
5 Correct 7 ms 740 KB Output is correct
6 Correct 136 ms 20000 KB Output is correct
7 Correct 121 ms 19964 KB Output is correct
8 Correct 126 ms 19988 KB Output is correct
9 Correct 12248 ms 20688 KB Output is correct
10 Correct 50 ms 11988 KB Output is correct
11 Correct 50 ms 12068 KB Output is correct
12 Correct 17574 ms 13724 KB Output is correct
13 Correct 50 ms 12072 KB Output is correct
14 Correct 49 ms 11988 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 308 ms 1280 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 5 ms 724 KB Output is correct
28 Execution timed out 20083 ms 20120 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 596 KB Output is correct
2 Correct 5 ms 724 KB Output is correct
3 Correct 7 ms 728 KB Output is correct
4 Correct 7 ms 736 KB Output is correct
5 Correct 7 ms 724 KB Output is correct
6 Correct 130 ms 19916 KB Output is correct
7 Correct 115 ms 19928 KB Output is correct
8 Correct 126 ms 19924 KB Output is correct
9 Correct 12062 ms 20916 KB Output is correct
10 Correct 49 ms 11988 KB Output is correct
11 Correct 50 ms 12092 KB Output is correct
12 Correct 18176 ms 13556 KB Output is correct
13 Correct 55 ms 12076 KB Output is correct
14 Correct 49 ms 12076 KB Output is correct
15 Correct 146 ms 19896 KB Output is correct
16 Execution timed out 20099 ms 20060 KB Time limit exceeded
17 Halted 0 ms 0 KB -