#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXR = 5000;
const int MAXC = 200;
typedef long long ll;
const ll INF = 1e15;
ll H[MAXR][MAXC]={},V[MAXR][MAXC]={};
int C,R;
void init(int RR, int CC, int HH[5000][200], int VV[5000][200]) {
C=CC,R=RR;
for (int i = 0; i < R; i++){
for (int j = 0; j < C; j++){
if (j+1<C) H[i][j]=HH[i][j];
if (i+1<R) V[i][j]=VV[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;
}
ll ans[MAXR][MAXC];
ll nans[MAXR][MAXC];
ll cur[MAXR][MAXC];
int escape(int V1, int V2) {
for (int i = 0; i < C; i++){
for (int j = 0; j < C; j++){
if (i==j) ans[i][j]=0;
else ans[i][j]=INF;
}
}
for (int x = 0; x < R; x++){
for (int i = 0; i < C; i++){
ll somma = 0;
for (int j = i; j < C; j++){
cur[i][j]=somma+V[x][j];
somma+=H[x][j];
}
somma=0;
for (int j = i-1; j >= 0; j--){
somma+=H[x][j];
cur[i][j]=somma+V[x][j];
}
for (int j = 0; j < C; j++){
nans[i][j]=INF;
for (int k = 0; k < C; k++){
nans[i][j]=min(nans[i][j],ans[i][k]+cur[k][j]);
}
}
}
for (int i = 0; i < C; i++){
for (int j = 0; j < C; j++){
ans[i][j]=nans[i][j];
}
}
}
return ans[V1][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 |
18 ms |
19036 KB |
Output is correct |
2 |
Correct |
18 ms |
19036 KB |
Output is correct |
3 |
Correct |
5966 ms |
21760 KB |
Output is correct |
4 |
Correct |
17 ms |
19036 KB |
Output is correct |
5 |
Correct |
18 ms |
19132 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
1 ms |
8540 KB |
Output is correct |
8 |
Correct |
1 ms |
8796 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
4 |
Incorrect |
44 ms |
14684 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6426 ms |
14864 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
89 ms |
24668 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6331 ms |
14680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6517 ms |
14864 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |