QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#784456 | #692. Delete the Points | wjy2020 | RE | 0ms | 0kb | C++11 | 1.7kb | 2024-11-26 15:03:39 | 2024-11-26 15:04:00 |
answer
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
int T,n,lsh[3005],X[3005],Y[3005],cnt;
deque<int>v[3005];
int get(int x){return lower_bound(lsh+1,lsh+1+cnt,x)-lsh;}
void print(pair<int,int>x,pair<int,int>y){
pair<int,int>le=make_pair(max(x.fi,y.fi),max(x.se,y.se));int d=max(abs(x.fi-y.fi),abs(x.se-y.se));
cout<<le.fi-d<<' '<<le.se-d<<' '<<le.fi<<' '<<le.se<<"\n";
}
int main(){
freopen("stone.in","r",stdin);
freopen("stone.out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
T=1;
while(T--){
cin>>n,cnt=0;for(int i=1;i<=n;i++)cin>>X[i]>>Y[i],lsh[++cnt]=X[i];
sort(lsh+1,lsh+1+cnt),cnt=unique(lsh+1,lsh+1+cnt)-lsh-1;
for(int i=1;i<=cnt;i++)v[i].clear();for(int i=1;i<=n;i++)v[get(X[i])].push_back(Y[i]);
cout<<"Yes"<<"\n";
pair<int,int>fuck=make_pair(0x3f3f3f3f,0x3f3f3f3f);
for(int i=1;i<=cnt;i++){
sort(v[i].begin(),v[i].end());
while(v[i].size()>1){
int x=v[i][0];v[i].pop_front();
int y=v[i][0];v[i].pop_front();
if(y<fuck.se){
int d=y-x;
cout<<lsh[i]-d<<' '<<x<<' '<<lsh[i]<<' '<<y<<"\n";
}
else if(y>fuck.se){
print(fuck,make_pair(lsh[i],x)),fuck=make_pair(0x3f3f3f3f,0x3f3f3f3f),v[i].push_front(y);
}
else {
if(lsh[i]-fuck.fi>y-x)print(make_pair(lsh[i],x),make_pair(lsh[i],y));
else if(lsh[i]-fuck.fi<y-x)print(fuck,make_pair(lsh[i],y)),v[i].push_front(x);
else {
cout<<fuck.fi<<".5"<<' '<<x<<' '<<lsh[i]<<".5"<<' '<<y<<"\n";
}
}
}
if(v[i].size()){
if(fuck.fi==0x3f3f3f3f)fuck=make_pair(lsh[i],v[i][0]);
else {
print(fuck,make_pair(lsh[i],v[i][0])),fuck=make_pair(0x3f3f3f3f,0x3f3f3f3f);
}
}
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Dangerous Syscalls
input:
4 1 1 2 2 5 5 6 6