# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
59957 | Tenuun | Mecho (IOI09_mecho) | C++17 | 839 ms | 6780 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int n, s, u, V, x, y, z;
int a[803][803], dx[4]={0, 0, 1, -1}, dy[4]={1, -1, 0, 0};
int bear[803][803];
vector<string> v;
vector<pair<int, int> >bee, o;
queue<pair<int, int>>q, b;
queue<pair<pair<int, int>, int> >t;
bool BFS(){
while(!t.empty()){
if(t.front().second>=s) return false;
x=t.front().first.first, y=t.front().first.second, z=t.front().second;
t.pop();
if(a[x][y]!=-1) continue;
for(int i=0; i<4; i++){
if(v[x+dx[i]][y+dy[i]]=='D') return true;
if(v[x+dx[i]][y+dy[i]]=='G' && a[x+dx[i]][y+dy[i]]==-1 && bear[x+dx[i]][y+dy[i]]==-1){
bear[x+dx[i]][y+dy[i]]=z+1;
if(z+1>=s) o.push_back({x+dx[i], y+dy[i]});
else t.push({{x+dx[i], y+dy[i]}, z+1});
}
}
}
return false;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |