답안 #962255

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
962255 2024-04-13T09:46:21 Z simona1230 웜뱃 (IOI13_wombats) C++17
12 / 100
59 ms 96796 KB
#include <bits/stdc++.h>
#include "wombats.h"
using namespace std;

int r,c,h[5001][201],v[5001][201];
int dp[201][201][201];

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++)
        {
            h[i][j]=H[i][j];
            v[i][j]=V[i][j];
        }
    }
    //cout<<r<<" "<<c<<endl;
    for(int i=0; i<r; i++)
    {
        for(int j=0; j<c; j++)
        {
            for(int k=0; k<c; k++)
            {
                dp[i][j][k]=1e9;
            }
            dp[0][j][j]=0;
        }
    }

    for(int k=0; k<c; k++)
        for(int i=0; i<r; i++)
        {
            for(int j=c-1; j>=0; j--)
            {
                //cout<<dp[i][j][k]<<endl;
                if(i>0)dp[i][j][k]=min(dp[i][j][k],dp[i-1][j][k]+v[i-1][j]);
                if(j<c-1)dp[i][j][k]=min(dp[i][j][k],dp[i][j+1][k]+h[i][j]);
            }
            for(int j=0; j<c; j++)
            {
                //cout<<dp[i][j][k]<<endl;
                if(i>0)dp[i][j][k]=min(dp[i][j][k],dp[i-1][j][k]+v[i-1][j]);
                if(j>0)dp[i][j][k]=min(dp[i][j][k],dp[i][j-1][k]+h[i][j-1]);
                //cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<endl;
            }
        }
}

void changeH(int x,int y,int w)
{
    h[x][y]=w;
}

void changeV(int x,int y,int w)
{
    v[x][y]=w;
}

int escape(int x,int y)
{
    return dp[r-1][y][x];
}

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 Runtime error 53 ms 88520 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 2 ms 12636 KB Output is correct
5 Correct 2 ms 12636 KB Output is correct
6 Correct 2 ms 12632 KB Output is correct
7 Correct 2 ms 12636 KB Output is correct
8 Correct 3 ms 12636 KB Output is correct
9 Correct 2 ms 12636 KB Output is correct
10 Correct 2 ms 12736 KB Output is correct
11 Correct 59 ms 14816 KB Output is correct
12 Correct 2 ms 12636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 25180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 45 ms 96796 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 25432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 24924 KB Output isn't correct
2 Halted 0 ms 0 KB -