QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#319843 | #692. Delete the Points | xmb | WA | 2ms | 3864kb | C++14 | 1.6kb | 2024-02-03 10:37:54 | 2024-02-03 10:37:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int t,n;
struct node{
int x,y;
}mp[30010];
bool cmp(node a,node b){
if(a.x!=b.x)
return a.x<b.x;
return a.y<b.y;
}
stack<node> que;
node xx,yy,zz;
signed main(){
// freopen("stone10.in","r",stdin);
// freopen("stone10.ans","w",stdout);
// scanf("%d",&t);
// while(t--){
scanf("%d",&n);
puts("Yes");
for(int i=1;i<=n;i++)
scanf("%d%d",&mp[i].x,&mp[i].y);
sort(mp+1,mp+n+1,cmp);
for(int i=1;i<=n;i++) que.push({mp[i].x,mp[i].y});
while(que.size()>=3){
xx=que.top(); que.pop();
yy=que.top(); que.pop();
zz=que.top();
// cout<<"---"<<xx.x<<" "<<yy.x<<" "<<zz.x<<endl;
if(xx.x==yy.x)
cout<<yy.x<<" "<<yy.y<<" "<<yy.x+(xx.y-yy.y)<<" "<<xx.y<<"\n";
else{
if(yy.y<=xx.y)
cout<<yy.x<<" "<<yy.y<<" "<<max(xx.x-yy.x,xx.y-yy.y)+yy.x<<" "<<max(xx.x-yy.x,xx.y-yy.y)+yy.y<<"\n";
else{
if(zz.x==yy.x&&zz.y>xx.y){
cout<<zz.x<<" "<<zz.y<<" "<<zz.x+(yy.y-zz.y)<<" "<<yy.y<<"\n";
que.pop(); que.push(xx);
}
else if(zz.x==yy.x&&zz.y==xx.y){
if(yy.y-zz.y<=xx.x-zz.x){
cout<<(double)(zz.x)-0.5<<" "<<zz.y<<" "<<(double)(zz.x)-0.5+(double)(yy.y-zz.y)<<" "<<yy.y<<"\n";
que.pop(); que.push(xx);
}
else{
cout<<zz.x<<" "<<zz.y<<" "<<xx.x<<" "<<zz.y+(xx.x-zz.x)<<"\n";
que.pop(); que.push(yy);
}
}
else
cout<<yy.x<<" "<<xx.y<<" "<<yy.x+max(yy.y-xx.y,xx.x-yy.x)<<" "<<xx.y+max(yy.y-xx.y,xx.x-yy.x)<<"\n";
}
}
}
cout<<0<<" "<<0<<" "<<1000000000<<" "<<1000000000<<"\n";
// }
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3664kb
input:
4 1 1 2 2 5 5 6 6
output:
Yes 5 5 6 6 0 0 1000000000 1000000000
result:
ok OK
Test #2:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
4 0 0 1 2 2 1 4 4
output:
Yes 2 1 5 4 0 0 1000000000 1000000000
result:
ok OK
Test #3:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
4 1 2 3 2 2 1 2 3
output:
Yes 2 2 3 3 0 0 1000000000 1000000000
result:
ok OK
Test #4:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
6 12 9 1 5 10 14 20 14 15 4 7 9
output:
Yes 15 4 25 14 10 9 15 14 0 0 1000000000 1000000000
result:
ok OK
Test #5:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
10 39 72 59 52 23 17 2 31 30 0 25 88 2 36 61 23 4 96 59 76
output:
Yes 59 52 83 76 39 23 88 72 25 0 113 88 4 17 83 96 0 0 1000000000 1000000000
result:
ok OK
Test #6:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
10 53 95 37 51 84 11 3 39 31 20 37 84 42 27 95 38 6 6 16 19
output:
Yes 84 11 111 38 42 27 110 95 37 51 70 84 16 19 31 34 0 0 1000000000 1000000000
result:
ok OK
Test #7:
score: -100
Wrong Answer
time: 2ms
memory: 3864kb
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 9.97371e+08 135791684 9.97371e+08 135791685 997371370 135791683 997371371 135791684 997371370 135791677 997371371 135791678 997371370 135791674 997371372 135791676 997371369 135791684 997371370 135791685 997371369 135791679 997371373 135791683 997371369 135791677 997371370 135791678 997371369 13...
result:
wrong answer Expected double but found NAN.