QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#784459 | #692. Delete the Points | wjy2020 | WA | 2ms | 5848kb | C++11 | 1.7kb | 2024-11-26 15:04:18 | 2024-11-26 15:04:23 |
Judging History
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(){
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: 100
Accepted
time: 0ms
memory: 5632kb
input:
4 1 1 2 2 5 5 6 6
output:
Yes 1 1 2 2 5 5 6 6
result:
ok OK
Test #2:
score: 0
Accepted
time: 1ms
memory: 5644kb
input:
4 0 0 1 2 2 1 4 4
output:
Yes -1 0 1 2 1 1 4 4
result:
ok OK
Test #3:
score: 0
Accepted
time: 1ms
memory: 5580kb
input:
4 1 2 3 2 2 1 2 3
output:
Yes 1 1 2 2 2 2 3 3
result:
ok OK
Test #4:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
6 12 9 1 5 10 14 20 14 15 4 7 9
output:
Yes 1 3 7 9 7 9 12 14 10 4 20 14
result:
ok OK
Test #5:
score: 0
Accepted
time: 1ms
memory: 5848kb
input:
10 39 72 59 52 23 17 2 31 30 0 25 88 2 36 61 23 4 96 59 76
output:
Yes -3 31 2 36 -56 17 23 96 -58 0 30 88 39 52 59 72 8 23 61 76
result:
ok OK
Test #6:
score: 0
Accepted
time: 1ms
memory: 5564kb
input:
10 53 95 37 51 84 11 3 39 31 20 37 84 42 27 95 38 6 6 16 19
output:
Yes -27 6 6 39 16 5 31 20 4 51 37 84 -15 27 53 95 68 11 95 38
result:
ok OK
Test #7:
score: -100
Wrong Answer
time: 2ms
memory: 5548kb
input:
3000 997371332 135791687 997371332 135791686 997371332 135791685 997371333 135791685 997371333 135791687 997371334 135791687 997371333 135791688 997371331 135791686 997371333 135791689 997371334 135791686 997371334 135791689 997371333 135791684 997371332 135791689 997371331 135791685 997371334 13579...
output:
Yes 997371303 135791684 997371304 135791685 997371303.5 135791708 997371304.5 135791709 997371304 135791685 997371305 135791686 997371301 135791694 997371305 135791698 997371304 135791707 997371305 135791708 997371303 135791707 997371305 135791709 997371305 135791684 997371306 135791685 997371304 13...
result:
wrong answer We have 1 point(s) in query 221