#include <bits/stdc++.h>
#include "wombats.h"
#define ii pair< int , int>
#define se second
#define fi first
using namespace std;
const int N=5e3+55;
int sum[N][2][2];
int v[N][2];
int h[N][2];
int n,m;
vector < ii > vec[N];
void init(int R, int C, int H[5000][200], int V[5000][200])
{
n=R;
m=C;
int cnt=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
v[i][j]=V[i][j];
h[i][j]=H[i][j];
if(j+1!=m)
{
vec[cnt].push_back({cnt+1,h[i][j]});
vec[cnt+1].push_back({cnt,h[i][j]});
}
if(i+1!=n)
vec[cnt].push_back({cnt+m,v[i][j]});
cnt++;
}
}
}
void changeH(int P, int Q, int W)
{
h[P][Q]=W;
}
void changeV(int P, int Q, int W)
{
v[P][Q]=W;
}
priority_queue < ii , vector < ii > , greater < ii > > pq;
int dist[5000000];
int escape(int V1, int V2)
{
pq.push({0,V1});
for(int i=0;i<n*m;i++)
dist[i]=1e9;
int u,c;
while(pq.size())
{
u=pq.top().se;
c=pq.top().fi;
pq.pop();
if(dist[u]<c)
continue ;
int v,d;
for(int i=0;i<vec[u].size();i++)
{
v=vec[u][i].fi;
d=vec[u][i].se;
if(d+c<dist[v])
{
dist[v]=u;
pq.push({c+d,v});
}
}
}
return dist[(n-1)*m+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:66:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<vec[u].size();i++)
~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
66 ms |
4676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4676 KB |
Output is correct |
2 |
Incorrect |
3 ms |
4676 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
11 ms |
4676 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
30 ms |
17348 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
14 ms |
17348 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
15 ms |
17348 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |