# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1230214 | Ludissey | Fountain Parks (IOI21_parks) | C++20 | 0 ms | 0 KiB |
for (int i = 0; i < n; i++)
{
if(sz(neigh[i])!=2) continue;
int _x=x[i];
int _y=y[i];
for (auto u : neigh[i])
{
if(a[u.first]>=0) continue;
if(u.second==0){
if(st.find({_x-1,_y-1})==st.end()){
st.insert({_x-1,_y-1});
a[u.first]=_x-1;
b[u.first]=_y-1;
}else{
st.insert({_x-1,_y+1});
a[u.first]=_x-1;
b[u.first]=_y+1;
}
}else if(u.second==1){
if(st.find({_x-1,_y-1})==st.end()){
st.insert({_x-1,_y-1});
a[u.first]=_x-1;
b[u.first]=_y-1;
}else{
st.insert({_x+1,_y-1});
a[u.first]=_x+1;
b[u.first]=_y-1;
}
}else if(u.second==2){
if(st.find({_x-1,_y+1})==st.end()){
st.insert({_x-1,_y+1});
a[u.first]=_x-1;
b[u.first]=_y+1;
}else{
st.insert({_x+1,_y+1});
a[u.first]=_x+1;
b[u.first]=_y+1;
}
}else{
if(st.find({_x+1,_y-1})==st.end()){
st.insert({_x+1,_y-1});
a[u.first]=_x+1;
b[u.first]=_y-1;
}else{
st.insert({_x+1,_y+1});
a[u.first]=_x+1;
b[u.first]=_y+1;
}
}
}
}