Submission #962308

# Submission time Handle Problem Language Result Execution time Memory
962308 2024-04-13T10:23:21 Z Ice_man Wombats (IOI13_wombats) C++14
9 / 100
892 ms 220192 KB
/**
 ____    ____    ____    __________________    ____    ____    ____
||I ||  ||c ||  ||e ||  ||                ||  ||M ||  ||a ||  ||n ||
||__||  ||__||  ||__||  ||________________||  ||__||  ||__||  ||__||
|/__\|  |/__\|  |/__\|  |/________________\|  |/__\|  |/__\|  |/__\|

*/

#include "wombats.h"
#include <bits/stdc++.h>

#define maxn 5005
#define maxn2 205


using namespace std;

int c, r;
int h[maxn][maxn2];
int v[maxn][maxn2];




int dp[200][5000][200];



void calc_row(int i, int j)
{
    for(int k = 1; k < c; k++)
        dp[i][j][k] = min(dp[i][j][k], dp[i][j][k - 1] + h[j][k - 1]);

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



void calc_dp(int i)
{
    for(int j = 0; j < r; j++)
        for(int k = 0; k < c; k++)
            dp[i][j][k] = 1e9;
    dp[i][0][i] = 0;

    calc_row(i, 0);


    for(int j = 1; j < r; j++)
    {
        for(int k = 0; k < c; k++)
            dp[i][j][k] = dp[i][j - 1][k] + v[j - 1][k];
        calc_row(i, j);
    }
}



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 + 1 < r)
                v[i][j] = V[i][j];
            if(j + 1 < c)
                h[i][j] = H[i][j];
        }

    for(int i = 0; i < c; i++)
        calc_dp(i);
}



void changeH(int P , int Q , int W)
{
    h[P][Q] = W;
    for(int i = 0; i < c; i++)
        calc_dp(i);
}


void changeV(int P , int Q , int W)
{
    v[P][Q] = W;
    for(int i = 0; i < c; i++)
        calc_dp(i);
}


int escape(int V1 , int V2)
{
    return dp[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 14 ms 16988 KB Output is correct
2 Correct 21 ms 17240 KB Output is correct
3 Correct 70 ms 18392 KB Output is correct
4 Correct 15 ms 16984 KB Output is correct
5 Correct 15 ms 16988 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Incorrect 11 ms 47452 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 892 ms 220192 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 25452 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 845 ms 202364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 839 ms 220144 KB Output isn't correct
2 Halted 0 ms 0 KB -