Submission #1011766

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10117662024-07-01 08:09:46bachhoangxuanFountain Parks (IOI21_parks)C++17
100 / 100
470 ms29908 KiB
#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++){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...