답안 #64407

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
64407 2018-08-04T10:14:07 Z theknife2001 웜뱃 (IOI13_wombats) C++17
18 / 100
82 ms 10080 KB
#include <bits/stdc++.h>
#include "wombats.h"

using namespace std;
const int N=5e3+55;
int sum[N][2][2];
int v[N][2];
int h[N][2];
int n,m;

void build()
{
    sum[0][1][0]=h[0][0];
    sum[0][0][1]=h[0][0];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            sum[i][j][0]=min(sum[i-1][j][0]+v[i-1][j],sum[i-1][j^1][0]+h[i][0]+v[i-1][j^1]);
            sum[i][j][1]=min(sum[i-1][j][1]+v[i-1][j],sum[i-1][j^1][1]+h[i][0]+v[i-1][j^1]);
        }
    }

}

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;j++)
        {
            v[i][j]=V[i][j];
            h[i][j]=H[i][j];
        }
    }
    build();
}

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

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

}

int escape(int V1, int V2)
{
    return sum[n-1][V2][V1];
}

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 4344 KB Output is correct
2 Incorrect 21 ms 4584 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4584 KB Output is correct
2 Incorrect 2 ms 4584 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 4584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 8520 KB Output is correct
2 Correct 49 ms 8520 KB Output is correct
3 Correct 32 ms 8704 KB Output is correct
4 Correct 82 ms 10080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 10080 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 10080 KB Output isn't correct
2 Halted 0 ms 0 KB -