답안 #962234

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
962234 2024-04-13T09:27:38 Z serkanrashid 웜뱃 (IOI13_wombats) C++14
55 / 100
20000 ms 32400 KB
#include "wombats.h"
#include <bits/stdc++.h>

using namespace std;

int r,c;
int h[5000][200],v[5000][200];
unsigned int inf = -1;
long long d[5000][200];
int sum;

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

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

int escape(int V1, int V2)
{
    if(c==1) return sum;
    for(int i = 0; i < r; i++)
    {
        for(int j = 0; j < c; j++) d[i][j] = inf;
    }
    d[0][V1] = 0;
    for(int i = 0; i < r-1; i++)
    {
        for(int j = 1; j < c; j++) d[i][j] = min(d[i][j],d[i][j-1]+h[i][j-1]);
        for(int j = c-2; j >= 0; j--) d[i][j] = min(d[i][j],d[i][j+1]+h[i][j]);
        for(int j = 0; j < c; j++) d[i+1][j] = min(d[i+1][j],d[i][j]+v[i][j]);
    }
    int i = r-1;
    for(int j = 1; j < c; j++) d[i][j] = min(d[i][j],d[i][j-1]+h[i][j-1]);
    for(int j = c-2; j >= 0; j--) d[i][j] = min(d[i][j],d[i][j+1]+h[i][j]);
    int pom = d[r-1][V2];
    return pom;
}

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-1;j++) h[i][j] = H[i][j];

    for(int i=0;i<R-1;i++)
        for(int j=0;j<C;j++)
        {
            v[i][j] = V[i][j];
            sum += v[i][j];
        }

}

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 2 ms 10840 KB Output is correct
2 Correct 2 ms 10844 KB Output is correct
3 Correct 58 ms 12376 KB Output is correct
4 Correct 3 ms 10844 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2404 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 6644 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6656 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 2 ms 6488 KB Output is correct
9 Correct 2 ms 6492 KB Output is correct
10 Correct 2 ms 6492 KB Output is correct
11 Correct 499 ms 7588 KB Output is correct
12 Correct 2 ms 6488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 6744 KB Output is correct
2 Correct 10 ms 6748 KB Output is correct
3 Correct 9 ms 6748 KB Output is correct
4 Correct 8 ms 6844 KB Output is correct
5 Correct 9 ms 6748 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 9 ms 6748 KB Output is correct
10 Correct 2 ms 6492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 23900 KB Output is correct
2 Correct 80 ms 23924 KB Output is correct
3 Correct 70 ms 23900 KB Output is correct
4 Correct 6854 ms 24712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 6748 KB Output is correct
2 Correct 8 ms 6748 KB Output is correct
3 Correct 8 ms 6748 KB Output is correct
4 Correct 9 ms 6748 KB Output is correct
5 Correct 8 ms 6636 KB Output is correct
6 Correct 69 ms 23896 KB Output is correct
7 Correct 77 ms 23916 KB Output is correct
8 Correct 72 ms 23900 KB Output is correct
9 Correct 6777 ms 24668 KB Output is correct
10 Correct 2 ms 10840 KB Output is correct
11 Correct 2 ms 10844 KB Output is correct
12 Correct 66 ms 13676 KB Output is correct
13 Correct 2 ms 10844 KB Output is correct
14 Correct 2 ms 10844 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 2 ms 6744 KB Output is correct
20 Correct 2 ms 6488 KB Output is correct
21 Correct 3 ms 6492 KB Output is correct
22 Correct 2 ms 6592 KB Output is correct
23 Correct 2 ms 6492 KB Output is correct
24 Correct 2 ms 6660 KB Output is correct
25 Correct 500 ms 8972 KB Output is correct
26 Correct 3 ms 6492 KB Output is correct
27 Correct 9 ms 6916 KB Output is correct
28 Execution timed out 20007 ms 27632 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 6748 KB Output is correct
2 Correct 8 ms 6748 KB Output is correct
3 Correct 8 ms 6748 KB Output is correct
4 Correct 8 ms 6748 KB Output is correct
5 Correct 8 ms 6744 KB Output is correct
6 Correct 73 ms 23900 KB Output is correct
7 Correct 76 ms 24144 KB Output is correct
8 Correct 79 ms 23920 KB Output is correct
9 Correct 6896 ms 24680 KB Output is correct
10 Correct 3 ms 10844 KB Output is correct
11 Correct 3 ms 10844 KB Output is correct
12 Correct 55 ms 13440 KB Output is correct
13 Correct 4 ms 10844 KB Output is correct
14 Correct 3 ms 10904 KB Output is correct
15 Correct 181 ms 32400 KB Output is correct
16 Execution timed out 20026 ms 30448 KB Time limit exceeded
17 Halted 0 ms 0 KB -