답안 #962305

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
962305 2024-04-13T10:19:27 Z Ice_man 웜뱃 (IOI13_wombats) C++17
9 / 100
794 ms 115672 KB
/**
 ____    ____    ____    __________________    ____    ____    ____
||I ||  ||c ||  ||e ||  ||                ||  ||M ||  ||a ||  ||n ||
||__||  ||__||  ||__||  ||________________||  ||__||  ||__||  ||__||
|/__\|  |/__\|  |/__\|  |/________________\|  |/__\|  |/__\|  |/__\|

*/

#include"wombats.h"
#include <iostream>

#define maxn 5005
#define maxn2 205


using namespace std;

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




int dp[5001][2][5001];



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;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 111184 KB Output is correct
2 Correct 57 ms 111436 KB Output is correct
3 Correct 115 ms 113732 KB Output is correct
4 Correct 59 ms 111452 KB Output is correct
5 Correct 59 ms 111408 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 4696 KB Output is correct
# 결과 실행 시간 메모리 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 3 ms 10588 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 785 ms 14956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 144 ms 115672 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 794 ms 14940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 788 ms 14856 KB Output isn't correct
2 Halted 0 ms 0 KB -