# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
29738 |
2017-07-20T11:59:32 Z |
kavun |
Wombats (IOI13_wombats) |
C++14 |
|
20000 ms |
19680 KB |
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
priority_queue <iii> Q;
int h[5000][200],v[5000][200];
int n,m;
void init(int R, int C, int H[5000][200], int V[5000][200]) {
n = R;
m = C;
for(int i = 0; i< 5000; i++)
for(int j = 0; j < 200; j++)
{
h[i][j] = H[i][j];
v[i][j] = V[i][j];
}
}
void changeH(int P, int Q, int W) {
/* ... */
}
void changeV(int P, int Q, int W) {
/* ... */
}
int escape(int V1, int V2) {
int dist[5010][110];
for(int i = 0; i < 5010; i++)
for(int j = 0;j < 110; j++)
dist[i][j] = 1e9;
dist[0][V1] = 0;
Q.push(iii(0,ii(0,V1)));
while(!Q.empty())
{
iii pr = Q.top();
Q.pop();
int d = -pr.first;
int x = pr.second.first;
int y = pr.second.second;
if(x + 1 < n)
{
if(dist[x][y] + v[x][y] < dist[x+1][y])
{
dist[x+1][y] = dist[x][y] + v[x][y];
Q.push(iii(-dist[x+1][y],ii(x+1,y)));
}
}
if(y + 1 < m)
{
if(dist[x][y] + h[x][y] < dist[x][y+1])
{
dist[x][y+1] = dist[x][y] + h[x][y];
Q.push(iii(-dist[x][y+1],ii(x,y+1)));
}
}
if(y - 1 >= 0)
{
if(dist[x][y] + h[x][y-1] < dist[x][y-1])
{
dist[x][y-1] = dist[x][y] + h[x][y-1];
Q.push(iii(-dist[x][y-1],ii(x,y-1)));
}
}
}
return dist[n-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;
^
wombats.cpp: In function 'int escape(int, int)':
wombats.cpp:44:11: warning: unused variable 'd' [-Wunused-variable]
int d = -pr.first;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
236 ms |
19680 KB |
Output is correct |
2 |
Incorrect |
256 ms |
19672 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
19680 KB |
Output is correct |
2 |
Correct |
6 ms |
19676 KB |
Output is correct |
3 |
Correct |
0 ms |
19676 KB |
Output is correct |
4 |
Correct |
169 ms |
19672 KB |
Output is correct |
5 |
Correct |
156 ms |
19672 KB |
Output is correct |
6 |
Correct |
183 ms |
19672 KB |
Output is correct |
7 |
Correct |
179 ms |
19676 KB |
Output is correct |
8 |
Correct |
146 ms |
19676 KB |
Output is correct |
9 |
Correct |
153 ms |
19672 KB |
Output is correct |
10 |
Correct |
139 ms |
19672 KB |
Output is correct |
11 |
Execution timed out |
20000 ms |
19676 KB |
Execution timed out |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
183 ms |
19676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1008 ms |
19676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
219 ms |
19680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
206 ms |
19676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |