# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
71360 |
2018-08-24T12:18:29 Z |
tamtam |
Wombats (IOI13_wombats) |
C++14 |
|
6112 ms |
18052 KB |
#include "wombats.h"
#include <bits/stdc++.h>
#define F first
#define S seoncd
typedef long long ll;
using namespace std;
int r,c;
int h[5010][210];
int v[5010][210];
int dp[110][110][3];
int en;
int Solve (int x,int y,int d){
if (x==r-1&&y==en){
return 0;
}
int &res=dp[x][y][d];
if (res!=-1)return res;
res=1000000000;
if (y>0&&d!=2){
res=min(res,Solve(x,y-1,1)+h[x][y-1]);
}
if (y<c-1&&d!=1){
res=min(res,Solve(x,y+1,2)+h[x][y]);
}
if (x<r-1)
res=min(res,Solve(x+1,y,0)+v[x][y]);
return res;
}
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 l=0;l<c-1;l++){
h[i][l]=H[i][l];
}
}
for (int i=0;i<r-1;i++){
for (int l=0;l<c;l++){
v[i][l]=V[i][l];
}
}
}
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) {
memset(dp,-1,sizeof dp);
en=V2;
return Solve(0,V1,0);
}
/*
3 4
0 2 5
7 1 1
0 4 0
0 0 0 2
0 3 4 7
5
3 2 1
3 3 3
2 0 0 5
1 1 1 6
3 2 1
*/
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;
^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
8440 KB |
Output is correct |
2 |
Incorrect |
15 ms |
8568 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
8568 KB |
Output is correct |
2 |
Correct |
3 ms |
8568 KB |
Output is correct |
3 |
Correct |
2 ms |
8568 KB |
Output is correct |
4 |
Correct |
14 ms |
8568 KB |
Output is correct |
5 |
Correct |
13 ms |
8568 KB |
Output is correct |
6 |
Correct |
20 ms |
8568 KB |
Output is correct |
7 |
Correct |
18 ms |
8568 KB |
Output is correct |
8 |
Correct |
14 ms |
8568 KB |
Output is correct |
9 |
Correct |
12 ms |
8568 KB |
Output is correct |
10 |
Correct |
12 ms |
8568 KB |
Output is correct |
11 |
Correct |
6112 ms |
8568 KB |
Output is correct |
12 |
Correct |
14 ms |
8568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
8568 KB |
Output is correct |
2 |
Correct |
68 ms |
8568 KB |
Output is correct |
3 |
Correct |
69 ms |
8568 KB |
Output is correct |
4 |
Correct |
72 ms |
8568 KB |
Output is correct |
5 |
Correct |
96 ms |
8568 KB |
Output is correct |
6 |
Correct |
3 ms |
8568 KB |
Output is correct |
7 |
Correct |
3 ms |
8568 KB |
Output is correct |
8 |
Correct |
3 ms |
8568 KB |
Output is correct |
9 |
Correct |
60 ms |
8568 KB |
Output is correct |
10 |
Correct |
3 ms |
8568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
17292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
17292 KB |
Output is correct |
2 |
Correct |
76 ms |
17292 KB |
Output is correct |
3 |
Correct |
61 ms |
17292 KB |
Output is correct |
4 |
Correct |
60 ms |
17292 KB |
Output is correct |
5 |
Correct |
68 ms |
17292 KB |
Output is correct |
6 |
Incorrect |
32 ms |
17728 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
17728 KB |
Output is correct |
2 |
Correct |
65 ms |
17728 KB |
Output is correct |
3 |
Correct |
67 ms |
17728 KB |
Output is correct |
4 |
Correct |
95 ms |
17728 KB |
Output is correct |
5 |
Correct |
91 ms |
17728 KB |
Output is correct |
6 |
Incorrect |
29 ms |
18052 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |