# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896371 | abcvuitunggio | Fountain Parks (IOI21_parks) | C++17 | 569 ms | 54256 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 n,order[200001],p[200001],cnt;
map <int, int> mp[300001];
vector <int> px,py;
int f(int i){
return (p[i]==i?i:p[i]=f(p[i]));
}
bool unite(int i, int j){
i=f(i);
j=f(j);
if (i==j)
return false;
p[j]=i;
return true;
}
int construct_roads(vector <int> x, vector <int> y){
vector <int32_t> u,v,a,b;
n=x.size();
for (int i=0;i<n;i++)
mp[x[i]][y[i]]=i;
iota(order,order+n,0);
px=x,py=y;
sort(order,order+n,[](int i, int j){return make_pair(px[i],py[i])<make_pair(px[j],py[j]);});
for (int i=0;i<n;i++){
if (mp[x[i]-2].count(y[i])){
int X=x[i]-1,Y=(x[i]%4?(y[i]+3)/4*4-1:y[i]/4*4+1);
if (!mp[X].count(Y)){
u.push_back(i);
Compilation message (stderr)
# | 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... |