#include "wombats.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn = 5e3 + 20;
const int maxm = 1e2 + 20;
const int maxv = maxn * maxm;
const int maxe = maxn * maxm * 2;
int wH[maxn][maxm] , wV[maxn][maxm] , id;
int d[maxm][maxm] , n , m;
bool have[maxm];
int cd(int a , int b)
{
return a * m + b;
}
void dij(int src)
{
if(have[src])
return;
have[src] = 1;
memset(d[src] , 63 , sizeof d[src]);
d[src][src] = 0;
for(int i = 0; i < n; i++)
{
for(int j = 0; j + 1 < m; j++)
{
int v = j , u = j + 1;
d[src][u] = min(d[src][u] , d[src][v] + wH[i][j]);
d[src][v] = min(d[src][v] , d[src][u] + wH[i][j]);
}
for(int j = m - 2; j >= 0; j--)
{
int v = j , u = j + 1;
d[src][u] = min(d[src][u] , d[src][v] + wH[i][j]);
d[src][v] = min(d[src][v] , d[src][u] + wH[i][j]);
}
if(i + 1 < n)
for(int j = 0; j < m; j++)
d[src][j] += wV[i][j];
}
}
void init(int R, int C, int H[5000][200], int V[5000][200])
{
n = R , m = C;
for(int i = 0; i < n; i++)
for(int j = 0; j + 1 < m; j++)
wH[i][j] = H[i][j];
for(int i = 0; i + 1 < n; i++)
for(int j = 0; j < m; j++)
wV[i][j] = V[i][j];
}
void changeH(int P, int Q, int W)
{
wH[P][Q] = W;
memset(have , 0 , sizeof have);
}
void changeV(int P, int Q, int W)
{
wV[P][Q] = W;
memset(have , 0 , sizeof have);
}
int escape(int V1, int V2)
{
dij(V1);
return d[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]
int res;
^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
6520 KB |
Output is correct |
2 |
Correct |
18 ms |
6520 KB |
Output is correct |
3 |
Correct |
94 ms |
8224 KB |
Output is correct |
4 |
Correct |
18 ms |
6520 KB |
Output is correct |
5 |
Correct |
18 ms |
6520 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
80 ms |
1400 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
632 KB |
Output is correct |
2 |
Correct |
13 ms |
632 KB |
Output is correct |
3 |
Correct |
13 ms |
632 KB |
Output is correct |
4 |
Correct |
13 ms |
632 KB |
Output is correct |
5 |
Correct |
13 ms |
632 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
9 ms |
632 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
77 ms |
12920 KB |
Output is correct |
2 |
Correct |
77 ms |
12896 KB |
Output is correct |
3 |
Correct |
78 ms |
12920 KB |
Output is correct |
4 |
Correct |
117 ms |
13576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
632 KB |
Output is correct |
2 |
Correct |
13 ms |
632 KB |
Output is correct |
3 |
Correct |
13 ms |
632 KB |
Output is correct |
4 |
Correct |
14 ms |
696 KB |
Output is correct |
5 |
Correct |
13 ms |
692 KB |
Output is correct |
6 |
Correct |
77 ms |
12792 KB |
Output is correct |
7 |
Correct |
79 ms |
12916 KB |
Output is correct |
8 |
Correct |
78 ms |
12908 KB |
Output is correct |
9 |
Correct |
118 ms |
13608 KB |
Output is correct |
10 |
Correct |
18 ms |
6636 KB |
Output is correct |
11 |
Correct |
18 ms |
6520 KB |
Output is correct |
12 |
Correct |
89 ms |
8216 KB |
Output is correct |
13 |
Correct |
19 ms |
6620 KB |
Output is correct |
14 |
Correct |
18 ms |
6520 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
79 ms |
1448 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
8 ms |
632 KB |
Output is correct |
28 |
Execution timed out |
20023 ms |
12980 KB |
Time limit exceeded |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
632 KB |
Output is correct |
2 |
Correct |
13 ms |
680 KB |
Output is correct |
3 |
Correct |
13 ms |
632 KB |
Output is correct |
4 |
Correct |
13 ms |
636 KB |
Output is correct |
5 |
Correct |
13 ms |
632 KB |
Output is correct |
6 |
Correct |
77 ms |
12920 KB |
Output is correct |
7 |
Correct |
79 ms |
12892 KB |
Output is correct |
8 |
Correct |
77 ms |
12792 KB |
Output is correct |
9 |
Correct |
117 ms |
13624 KB |
Output is correct |
10 |
Correct |
18 ms |
6520 KB |
Output is correct |
11 |
Correct |
19 ms |
6672 KB |
Output is correct |
12 |
Correct |
88 ms |
8312 KB |
Output is correct |
13 |
Correct |
18 ms |
6520 KB |
Output is correct |
14 |
Correct |
18 ms |
6520 KB |
Output is correct |
15 |
Incorrect |
274 ms |
12820 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |