# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
335552 |
2020-12-13T04:28:35 Z |
CursedCode |
Mecho (IOI09_mecho) |
C++14 |
|
0 ms |
0 KB |
#include<mecho.h>
#include <bits/stdc++.h>
#define x first
#define y second
#define mp make_pair
using namespace std;
int n, s;
pair<int, int> start, home;
int T, H;
int occ_time[805][805];
bool vis[805][805];
bool tree[805][805];
pair<int, int > Q[1000000];
int movex[] = {0, 0, -1, 1};
int movey[] = {-1, 1, 0, 0};
bool check(pair<int, int> v){
if(v.x >= 0 && v.x < n && v.y >= 0 && v.y < n && !tree[v.x][v.y] && !vis[v.x][v.y]) return 1;
return 0;
}
void init_bfs(){
pair<int, int> u, v;
while(H < T){
u = Q[H++];
if(u == home) continue;
//cout << u.x << ' ' << u.y << ' ' << occ_time[u.x][u.y] << endl;
for(int i = 0; i < 4; i++){
v = mp(u.x + movex[i], u.y + movey[i]);
if(!check(v)) continue;
occ_time[v.x][v.y] = occ_time[u.x][u.y] + s;
vis[v.x][v.y] = 1;
Q[T++] = v;
}
}
}
int dist[805][805];
bool solve(int st){
memset(vis, 0, sizeof(vis));
H = T = 0;
pair<int, int> u, v;
dist[start.x][start.y] = st;
Q[T++] = start;
while(H < T){
u = Q[H++];
if(u == home) return 1;
if(dist[u.x][u.y] >= occ_time[u.x][u.y]) continue;
for(int i = 0; i < 4; i++){
v = mp(u.x + movex[i], u.y + movey[i]);
if(!check(v)) continue;
dist[v.x][v.y] = dist[u.x][u.y] + 1;
vis[v.x][v.y] = 1;
Q[T++] = v;
}
}
return 0;
}
int search(){
int l = 0, r = 800 * 800 + 1;
int res = -1;
while(l <= r){
int mid = (l + r) / 2;
//cout << mid << endl;
if(solve(mid * s)){
l = mid + 1;
res = max(res, mid);
}
else r = mid - 1;
}
return res;
}
Compilation message
mecho.cpp:1:9: fatal error: mecho.h: No such file or directory
1 | #include<mecho.h>
| ^~~~~~~~~
compilation terminated.