답안 #1013851

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1013851 2024-07-04T06:53:57 Z huutuan 웜뱃 (IOI13_wombats) C++14
55 / 100
20000 ms 262144 KB
#include "wombats.h"

#include <bits/stdc++.h>

using namespace std;

int dist[100][5000][100];
int R, C, H[5000][200], V[5000][200];
bool sussy;

void solve(){
   for (int tt=0; tt<C; ++tt){
      for (int i=0; i<R; ++i) for (int j=0; j<C; ++j) dist[tt][i][j]=1e9;
      dist[tt][0][tt]=0;
      for (int i=0; i<R; ++i){
         for (int j=1, mn=dist[tt][i][0]; j<C; ++j){
            mn=min(mn+H[i][j-1], dist[tt][i][j]);
            dist[tt][i][j]=min(dist[tt][i][j], mn);
         }
         for (int j=C-2, mn=dist[tt][i][C-1]; j>=0; --j){
            mn=min(mn+H[i][j], dist[tt][i][j]);
            dist[tt][i][j]=min(dist[tt][i][j], mn);
         }
         if (i+1<R){
            for (int j=0; j<C; ++j) dist[tt][i+1][j]=dist[tt][i][j]+V[i][j];
         }
      }
   }
}

void init(int _R, int _C, int _H[5000][200], int _V[5000][200]) {
   R=_R, C=_C;
   memcpy(H, _H, sizeof H);
   memcpy(V, _V, sizeof V);
   sussy=1;
}

void changeH(int P, int Q, int W) {
   sussy=1;
   H[P][Q]=W;
}

void changeV(int P, int Q, int W) {
   sussy=1;
   V[P][Q]=W;
}

int escape(int V1, int V2) {
   if (sussy) solve();
   return dist[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 15 ms 14168 KB Output is correct
2 Correct 34 ms 14172 KB Output is correct
3 Correct 3580 ms 16812 KB Output is correct
4 Correct 15 ms 14184 KB Output is correct
5 Correct 18 ms 14172 KB Output is correct
6 Correct 6 ms 8284 KB Output is correct
7 Correct 7 ms 8284 KB Output is correct
8 Correct 3 ms 8284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8284 KB Output is correct
2 Correct 3 ms 8056 KB Output is correct
3 Correct 3 ms 8284 KB Output is correct
4 Correct 12 ms 8540 KB Output is correct
5 Correct 21 ms 8540 KB Output is correct
6 Correct 11 ms 8584 KB Output is correct
7 Correct 14 ms 8540 KB Output is correct
8 Correct 20 ms 8536 KB Output is correct
9 Correct 16 ms 8536 KB Output is correct
10 Correct 11 ms 8540 KB Output is correct
11 Correct 4584 ms 10832 KB Output is correct
12 Correct 12 ms 8540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 513 ms 13144 KB Output is correct
2 Correct 284 ms 13092 KB Output is correct
3 Correct 516 ms 13144 KB Output is correct
4 Correct 457 ms 13148 KB Output is correct
5 Correct 476 ms 13148 KB Output is correct
6 Correct 4 ms 8284 KB Output is correct
7 Correct 4 ms 8284 KB Output is correct
8 Correct 4 ms 8124 KB Output is correct
9 Correct 268 ms 12980 KB Output is correct
10 Correct 5 ms 8284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 131 ms 20056 KB Output is correct
2 Correct 102 ms 20060 KB Output is correct
3 Correct 98 ms 19868 KB Output is correct
4 Correct 9103 ms 21444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 485 ms 13144 KB Output is correct
2 Correct 288 ms 13004 KB Output is correct
3 Correct 496 ms 13148 KB Output is correct
4 Correct 523 ms 13144 KB Output is correct
5 Correct 510 ms 13148 KB Output is correct
6 Correct 100 ms 20060 KB Output is correct
7 Correct 97 ms 20060 KB Output is correct
8 Correct 164 ms 20056 KB Output is correct
9 Correct 8687 ms 21260 KB Output is correct
10 Correct 15 ms 14172 KB Output is correct
11 Correct 14 ms 14168 KB Output is correct
12 Correct 3829 ms 15560 KB Output is correct
13 Correct 17 ms 13916 KB Output is correct
14 Correct 16 ms 14012 KB Output is correct
15 Correct 7 ms 8284 KB Output is correct
16 Correct 5 ms 8284 KB Output is correct
17 Correct 7 ms 8284 KB Output is correct
18 Correct 19 ms 8536 KB Output is correct
19 Correct 12 ms 8540 KB Output is correct
20 Correct 15 ms 8540 KB Output is correct
21 Correct 16 ms 8540 KB Output is correct
22 Correct 17 ms 8540 KB Output is correct
23 Correct 13 ms 8540 KB Output is correct
24 Correct 12 ms 8540 KB Output is correct
25 Correct 4489 ms 10628 KB Output is correct
26 Correct 11 ms 8536 KB Output is correct
27 Correct 216 ms 13148 KB Output is correct
28 Execution timed out 20104 ms 215248 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 439 ms 13148 KB Output is correct
2 Correct 214 ms 12888 KB Output is correct
3 Correct 430 ms 13148 KB Output is correct
4 Correct 404 ms 13148 KB Output is correct
5 Correct 436 ms 13148 KB Output is correct
6 Correct 72 ms 20056 KB Output is correct
7 Correct 101 ms 20056 KB Output is correct
8 Correct 83 ms 19916 KB Output is correct
9 Correct 7484 ms 21308 KB Output is correct
10 Correct 15 ms 14168 KB Output is correct
11 Correct 14 ms 14168 KB Output is correct
12 Correct 3299 ms 15696 KB Output is correct
13 Correct 14 ms 13916 KB Output is correct
14 Correct 14 ms 14156 KB Output is correct
15 Runtime error 2622 ms 262144 KB Execution killed with signal 9
16 Halted 0 ms 0 KB -