#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int sum, R, C;
vector<vector<int>> H(5050,vector<int>(210,INF)), V(5050,vector<int>(210,INF));
void init(int Rt, int Ct, int tH[5000][200], int tV[5000][200]) {
/* ... */
R = Rt; C = Ct;
for (int i = 0; i < 5000; i++) for (int j = 0; j < 200; j++) {H[i][j] = tH[i][j]; V[i][j] = tV[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) {
// assert(V1 == 0 && V2 == 0);
priority_queue<tuple<int,int,int>> pq;
vector<vector<int>> dist(R,vector<int>(C,-1));
pq.push(make_tuple(V1,0,0));
while (!pq.empty()) {
int c,r,d; tie(c,r,d) = pq.top(); pq.pop();
if (dist[r][c] != -1) continue;
d *= -1;
dist[r][c] = d;
if (c > 0) pq.push(make_tuple(c-1,r,-(d + H[r][c-1])));
if (c < C-1) pq.push(make_tuple(c+1,r,-(d + H[r][c])));
if (r < R-1) pq.push(make_tuple(c,r+1,-(d + V[r][c])));
}
return dist[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]
int res;
^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
193 ms |
13216 KB |
Output is correct |
2 |
Correct |
192 ms |
13188 KB |
Output is correct |
3 |
Execution timed out |
20028 ms |
14012 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
8960 KB |
Output is correct |
2 |
Correct |
15 ms |
8960 KB |
Output is correct |
3 |
Correct |
12 ms |
8960 KB |
Output is correct |
4 |
Incorrect |
41 ms |
9080 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
216 ms |
9220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3886 ms |
17600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
249 ms |
9216 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
219 ms |
9220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |