#include<bits/stdc++.h>
#include "wombats.h"
using namespace std;
const int inf = 1e9;
int sum = 0;
int r, c;
vector<vector<int>> level;
vector<vector<int>> pass;
void init(int r, int c, int h[5000][200], int v[5000][200]) {
::r = r;
::c = c;
level.resize(r);
for (int i = 0; i < r; i++) {
level[i].resize(c-1);
for (int j = 0; j < c-1; j++) {
level[i][j] = h[i][j];
}
}
pass.resize(r-1);
for (int i = 0; i < r-1; i++) {
pass[i].resize(c);
for (int j = 0; j < c; j++) {
pass[i][j] = v[i][j];
}
}
}
void changeH(int p, int q, int w) {
pass[p][q] = w;
}
void changeV(int p, int q, int w) {
level[p][q] = w;
}
int escape(int v1, int v2) {
vector<int> dp(c);
for (int i = r-1; i >= 0; i--) {
vector<int> ndp(c, inf);
for (int j = 0; j < c; j++) {
for (int k = j - 1, sum = 0; k >= 0; k--) {
sum += level[i][k];
ndp[j] = min(ndp[j], dp[k] + sum);
}
for (int k = j, sum = 0; k < c; k++) {
ndp[j] = min(ndp[j], dp[k] + sum);
if (k < c-1) sum += level[i][k];
}
if (i) ndp[j] += pass[i-1][j];
}
dp.swap(ndp);
}
return dp[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;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
9044 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
980 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
88 ms |
8660 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
980 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
932 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |