Submission #290703

# Submission time Handle Problem Language Result Execution time Memory
290703 2020-09-04T10:46:47 Z Atill83 Wombats (IOI13_wombats) C++14
55 / 100
20000 ms 22088 KB
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
long long dp[205][2][205];
int h[5000][200], v[5000][200];
int r, c;
void clc(){
    memset(dp, 0x7f, sizeof(dp));
    for(int i = 0; i < c; i++){
        dp[i][0][i] = 0;
        int bas = 1;
        for(int j = 0; j < r; j++){
            if(!bas){
                for(int k = 0; k < c; k++){
                    dp[i][j&1][k] = dp[i][j&1^1][k] + v[j - 1][k];
                }
            }
            bas = 0;

            for(int k = 1; k < c; k++){
                dp[i][j&1][k] = min(dp[i][j&1][k], dp[i][j&1][k - 1] + h[j][k - 1]);
            }
            for(int k = c - 2; k >= 0; k--){
                dp[i][j&1][k] = min(dp[i][j&1][k], dp[i][j&1][k + 1] + h[j][k]);
            }
        }
    }


}


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; j++){
            if(i != R - 1) v[i][j] = V[i][j];
            if(j != C - 1) h[i][j] = H[i][j];
        }
    }
    clc();
}

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

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

int escape(int V1, int V2) {
    return dp[V1][(r - 1)%2][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;
      |      ^~~
wombats.cpp: In function 'void clc()':
wombats.cpp:15:44: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   15 |                     dp[i][j&1][k] = dp[i][j&1^1][k] + v[j - 1][k];
      |                                           ~^~
# Verdict Execution time Memory Grader output
1 Correct 31 ms 8960 KB Output is correct
2 Correct 28 ms 8832 KB Output is correct
3 Correct 114 ms 11640 KB Output is correct
4 Correct 28 ms 8960 KB Output is correct
5 Correct 28 ms 8832 KB Output is correct
6 Correct 1 ms 1024 KB Output is correct
7 Correct 1 ms 1024 KB Output is correct
8 Correct 1 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1024 KB Output is correct
2 Correct 1 ms 1024 KB Output is correct
3 Correct 1 ms 1024 KB Output is correct
4 Correct 1 ms 1024 KB Output is correct
5 Correct 1 ms 1024 KB Output is correct
6 Correct 1 ms 1024 KB Output is correct
7 Correct 1 ms 1024 KB Output is correct
8 Correct 1 ms 1024 KB Output is correct
9 Correct 1 ms 1024 KB Output is correct
10 Correct 1 ms 1024 KB Output is correct
11 Correct 89 ms 3448 KB Output is correct
12 Correct 1 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 915 ms 1656 KB Output is correct
2 Correct 899 ms 1528 KB Output is correct
3 Correct 917 ms 1528 KB Output is correct
4 Correct 929 ms 1528 KB Output is correct
5 Correct 953 ms 1436 KB Output is correct
6 Correct 1 ms 1024 KB Output is correct
7 Correct 1 ms 1024 KB Output is correct
8 Correct 1 ms 1024 KB Output is correct
9 Correct 4565 ms 1436 KB Output is correct
10 Correct 1 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 98 ms 16752 KB Output is correct
2 Correct 87 ms 16640 KB Output is correct
3 Correct 93 ms 16744 KB Output is correct
4 Correct 142 ms 18040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 920 ms 1428 KB Output is correct
2 Correct 897 ms 1420 KB Output is correct
3 Correct 1038 ms 1436 KB Output is correct
4 Correct 945 ms 1436 KB Output is correct
5 Correct 945 ms 1440 KB Output is correct
6 Correct 120 ms 16640 KB Output is correct
7 Correct 87 ms 16764 KB Output is correct
8 Correct 100 ms 16760 KB Output is correct
9 Correct 133 ms 18040 KB Output is correct
10 Correct 27 ms 8832 KB Output is correct
11 Correct 45 ms 8952 KB Output is correct
12 Correct 129 ms 11640 KB Output is correct
13 Correct 26 ms 8832 KB Output is correct
14 Correct 28 ms 8832 KB Output is correct
15 Correct 1 ms 1024 KB Output is correct
16 Correct 1 ms 1024 KB Output is correct
17 Correct 1 ms 1024 KB Output is correct
18 Correct 1 ms 1024 KB Output is correct
19 Correct 1 ms 1024 KB Output is correct
20 Correct 1 ms 1024 KB Output is correct
21 Correct 1 ms 1024 KB Output is correct
22 Correct 1 ms 1024 KB Output is correct
23 Correct 1 ms 1020 KB Output is correct
24 Correct 1 ms 1024 KB Output is correct
25 Correct 92 ms 3448 KB Output is correct
26 Correct 2 ms 1024 KB Output is correct
27 Correct 4722 ms 1432 KB Output is correct
28 Execution timed out 20087 ms 20376 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 902 ms 1408 KB Output is correct
2 Correct 893 ms 1528 KB Output is correct
3 Correct 931 ms 1528 KB Output is correct
4 Correct 916 ms 1528 KB Output is correct
5 Correct 910 ms 1528 KB Output is correct
6 Correct 86 ms 16640 KB Output is correct
7 Correct 85 ms 16640 KB Output is correct
8 Correct 86 ms 16760 KB Output is correct
9 Correct 130 ms 18040 KB Output is correct
10 Correct 28 ms 8832 KB Output is correct
11 Correct 28 ms 8832 KB Output is correct
12 Correct 115 ms 11640 KB Output is correct
13 Correct 29 ms 8832 KB Output is correct
14 Correct 27 ms 8832 KB Output is correct
15 Correct 9288 ms 22056 KB Output is correct
16 Execution timed out 20082 ms 22088 KB Time limit exceeded
17 Halted 0 ms 0 KB -