답안 #1076225

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1076225 2024-08-26T11:58:38 Z Trumling 웜뱃 (IOI13_wombats) C++14
55 / 100
20000 ms 33832 KB
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std; 

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()

ll sum=0;
vector<vector<ll>>dp;
int h[5000][200];
int v[5000][200];
int c;
int r;

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];
}

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

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

int escape(int V1, int V2) {
    
dp.assign(r,vector<ll>(c,INF));
dp[r-1][V2]=0;
//cout<<1;

for(int i=r-1;i>=0;i--)
    {
        
        if(i!=r-1)
            for(int j=0;j<c;j++)
                dp[i][j]=min(dp[i][j], dp[i+1][j] + v[i][j]);

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

return dp[0][V1];

}

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 21 ms 8536 KB Output is correct
2 Correct 28 ms 8540 KB Output is correct
3 Correct 7571 ms 11204 KB Output is correct
4 Correct 28 ms 8540 KB Output is correct
5 Correct 21 ms 8540 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 314 ms 2780 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 860 KB Output is correct
2 Correct 5 ms 924 KB Output is correct
3 Correct 9 ms 708 KB Output is correct
4 Correct 5 ms 860 KB Output is correct
5 Correct 7 ms 856 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 7 ms 860 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 16324 KB Output is correct
2 Correct 103 ms 16396 KB Output is correct
3 Correct 83 ms 16408 KB Output is correct
4 Correct 7532 ms 17776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 856 KB Output is correct
2 Correct 7 ms 860 KB Output is correct
3 Correct 6 ms 936 KB Output is correct
4 Correct 5 ms 936 KB Output is correct
5 Correct 7 ms 716 KB Output is correct
6 Correct 95 ms 16328 KB Output is correct
7 Correct 80 ms 16216 KB Output is correct
8 Correct 77 ms 16220 KB Output is correct
9 Correct 7919 ms 17784 KB Output is correct
10 Correct 22 ms 8792 KB Output is correct
11 Correct 22 ms 8536 KB Output is correct
12 Correct 7607 ms 11196 KB Output is correct
13 Correct 21 ms 8536 KB Output is correct
14 Correct 22 ms 8540 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 296 ms 2860 KB Output is correct
26 Correct 2 ms 348 KB Output is correct
27 Correct 5 ms 856 KB Output is correct
28 Execution timed out 20045 ms 23776 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 860 KB Output is correct
2 Correct 6 ms 860 KB Output is correct
3 Correct 5 ms 860 KB Output is correct
4 Correct 8 ms 856 KB Output is correct
5 Correct 6 ms 860 KB Output is correct
6 Correct 85 ms 16420 KB Output is correct
7 Correct 80 ms 16216 KB Output is correct
8 Correct 76 ms 16216 KB Output is correct
9 Correct 7130 ms 17664 KB Output is correct
10 Correct 22 ms 8540 KB Output is correct
11 Correct 21 ms 8576 KB Output is correct
12 Correct 7495 ms 11092 KB Output is correct
13 Correct 21 ms 11100 KB Output is correct
14 Correct 20 ms 11100 KB Output is correct
15 Correct 160 ms 33832 KB Output is correct
16 Execution timed out 20024 ms 31936 KB Time limit exceeded
17 Halted 0 ms 0 KB -