# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1074086 |
2024-08-25T07:48:42 Z |
Malix |
Wombats (IOI13_wombats) |
C++14 |
|
477 ms |
25176 KB |
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
#define REP(a,b,c) for(int a=b;a<c;a++)
#define F first
#define S second
#define PB push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
int inf=1000000010;
vii a(5000,vi(200,0)),b(5000,vi(200,0));
int n,m;
vi dist;
vector<vector<pi>> arr;
void init(int R, int C, int H[5000][200], int V[5000][200]) {
n=R;
m=C;
REP(i,0,5000)REP(j,0,200)a[i][j]=H[i][j];
REP(i,0,5000)REP(j,0,200)b[i][j]=V[i][j];
arr.resize(n*m+2);
REP(i,0,n*m){
if(i%m!=0)arr[i].PB({i+1,b[i/m][i%m]});
if(i+m<n*m+1)arr[i].PB({i+m,a[i/m][i%m]});
if(i%m!=1)arr[i].PB({i-1,a[(i-1)/m][(i-1)%m]});
}
}
void changeH(int P, int Q, int W) {
/* ... */
}
void changeV(int P, int Q, int W) {
b[P][Q]=W;
}
int escape(int V1, int V2) {
if(m==1){
int ans=0;
REP(i,0,n)REP(j,0,m)ans+=b[i][j];
return ans;
}
dist.clear();
dist.resize(n*m+2,inf);
dist[V1]=0;
priority_queue<pi,vector<pi>,greater<pi>> pq;
pq.push({0,0});
while(!pq.empty()){
int x=pq.top().F;
int y=pq.top().S;
pq.pop();
if(x!=dist[y])continue;
for(auto u:arr[y])if(dist[u.F]>x+u.S){
dist[u.F]=x+u.S;
pq.push({dist[u.F],u.F});
}
}
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]
15 | int res;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
19 ms |
25176 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
18 ms |
17244 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
9468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
477 ms |
17244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
9564 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
9560 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |