QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#687748 | #692. Delete the Points | 0xyz | WA | 1ms | 3664kb | C++14 | 1.4kb | 2024-10-29 20:59:56 | 2024-10-29 20:59:57 |
Judging History
answer
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef pair<int,int> P;
int T=1,n;
set<P>s;
void ouc(P a,P b){
cout<<b.F<<' '<<b.S<<' '<<b.F+max(a.F-b.F,b.S-a.S)<<' '<<b.S-max(a.F-b.F,b.S-a.S)<<'\n';
s.erase(a);s.erase(b);
}
void oul(P a,P b){
cout<<a.F<<' '<<a.S<<' '<<a.F+a.S-b.S<<' '<<b.S<<'\n';
s.erase(a);s.erase(b);
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
//cin>>T;
while(T--){
cin>>n;
for(int i=1,x,y;i<=n;i++)cin>>x>>y,s.insert({x,y});
cout<<"Yes\n";
while(s.size()){
set<P>::iterator p=s.end();
P a,b,c;
p--;a=*p;p--;b=*p;
if(a.F==b.F)oul(a,b);
else if(a.S>=b.S){
cout<<b.F<<' '<<b.S<<' '<<b.F+max(a.F-b.F,a.S-b.S)<<' '<<b.S+max(a.F-b.F,a.S-b.S)<<'\n';
s.erase(a);s.erase(b);
}else if(s.size()==2)ouc(a,b);
else{
p--;c=*p;
if(c.F!=b.F)ouc(a,b);
else if(c.S<a.S){
if(b.S-a.S>=a.F-b.F)oul(b,{b.F,a.S});
else{
cout<<a.F<<' '<<a.S<<' '<<b.F<<' '<<a.S+a.F-b.F<<'\n';
s.erase(a);s.erase(b);
}
}else if(c.S>a.S)oul(b,c);
else if(a.F-c.F>b.S-c.S)oul(b,c);
else if(a.F-c.F<b.S-c.S){
cout<<c.F<<' '<<c.S<<' '<<a.F<<' '<<c.S+a.F-c.F<<'\n';
s.erase(a);s.erase(c);
}else{
cout<<b.F-1<<".5 "<<b.S<<' '<<b.F+b.S-c.S-1<<".5 "<<c.S<<'\n';
s.erase(b);s.erase(c);
}
}
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3592kb
input:
4 1 1 2 2 5 5 6 6
output:
Yes 5 5 6 6 1 1 2 2
result:
ok OK
Test #2:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
4 0 0 1 2 2 1 4 4
output:
Yes 2 1 5 4 0 0 2 2
result:
ok OK
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3648kb
input:
4 1 2 3 2 2 1 2 3
output:
Yes 2 3 3 2 2 1 3 2 1 2 1 2
result:
wrong answer We have 1 point(s) in query 1