# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1011766 | bachhoangxuan | Fountain Parks (IOI21_parks) | C++17 | 470 ms | 29908 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 "parks.h"
#include<bits/stdc++.h>
using namespace std;
int dx[]={0,0,2,-2},
dy[]={2,-2,0,0};
int construct_roads(std::vector<int> X, std::vector<int> Y) {
int N=(int)X.size();
vector<int> U,V,A,B;
map<pair<int,int>,int> mp;
for(int i=0;i<N;i++) mp[{X[i],Y[i]}]=i;
int cnt=0;
vector<bool> vis(N);
queue<int> q;
q.push(0);vis[0]=1;
while(!q.empty()){
int u=q.front();q.pop();cnt++;
for(int t=0;t<4;t++){
int xt=X[u]+dx[t],yt=Y[u]+dy[t];
if(mp.count({xt,yt})){
int v=mp[{xt,yt}];
if(!vis[v]) q.push(v),vis[v]=1;
}
}
}
if(cnt!=N) return 0;
for(int i=0;i<N;i++){
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |