# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
846406 |
2023-09-07T14:26:16 Z |
vjudge1 |
ČVENK (COI15_cvenk) |
C++17 |
|
807 ms |
524288 KB |
#include <bits/stdc++.h>
typedef long long ll;
#define yem(re) (1ll<<((ll)(re)))
#define endl '\n'
#define pb push_back
#define int long long
#define mid ((left+right)/2)
using namespace std;
int n;
queue<pair<pair<int,int>,int>>q;
map<int,map<int,bool>>vis;
int32_t main(){
cin>>n;
pair<int,int>bas,tar;
cin>>bas.first>>bas.second>>tar.first>>tar.second;
q.push({bas,0});
while(q.size()){
int x=q.front().first.first,y=q.front().first.second,total=q.front().second;
q.pop();
if(vis[x][y])continue;
if(x&y!=0)continue;
if(x<0||y<0)continue;
if(x>=1e9||y>=1e9)continue;
if(x==tar.first&&y==tar.second){cout<<total;return 0;}
q.push({{x+1,y},total+1});
q.push({{x-1,y},total+1});
q.push({{x,y-1},total+1});
q.push({{x,y+1},total+1});
}
return 0;
}
Compilation message
cvenk.cpp: In function 'int32_t main()':
cvenk.cpp:24:9: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
24 | if(x&y!=0)continue;
| ~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
759 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
807 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
742 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |