QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#56112 | #692. Delete the Points | feecle6418 | WA | 3ms | 3792kb | C++20 | 1.3kb | 2022-10-17 09:34:02 | 2022-10-17 09:34:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef array<int,2> S;
int n;
S a[3005];
void Solve(){
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d%d",&a[i][0],&a[i][1]);
sort(a+1,a+n+1);
puts("Yes");
for(int i=n/2;i>=1;i--){
int x=2*i,y=2*i-1;
if(a[x][0]==a[y][0]){
cout<<a[x][0]<<' '<<a[x][1]<<' ';
cout<<a[x][0]+(a[y][1]-a[x][1])<<' '<<a[y][1]<<'\n';
continue;
}
if(a[x][1]>=a[y][1]){
cout<<a[y][0]<<' '<<a[y][1]<<' ';
int w=max(a[x][0]-a[y][0],a[x][1]-a[y][1]);
cout<<a[y][0]+w<<' '<<a[y][1]+w<<'\n';
continue;
}
int z=2*i-2;
if(z==0||a[z][0]!=a[y][0]||a[z][1]<a[x][1]){
cout<<a[y][0]<<' '<<a[x][1]<<' ';
int w=max(a[x][0]-a[y][0],a[y][1]-a[x][1]);
cout<<a[y][0]+w<<' '<<a[x][1]+w<<'\n';
continue;
}
if(a[z][1]>a[x][1]){
cout<<a[z][0]<<' '<<a[z][1]<<' ';
cout<<a[z][0]+(a[y][1]-a[z][1])<<' '<<a[y][1]<<'\n';
swap(a[x],a[z]);
continue;
}
if(a[y][1]-a[z][1]<=a[x][0]-a[z][0]){
printf("%.1lf %d ",a[y][0]-0.5,a[y][1]);
printf("%.1lf %d\n",a[y][0]-0.5+(a[y][1]-a[z][1]),a[z][1]);
swap(a[x],a[z]);
}
else {
cout<<a[z][0]<<' '<<a[z][1]<<' ';
cout<<a[x][0]<<' '<<a[z][1]+(a[x][0])<<'\n';
swap(a[y],a[z]);
}
}
}
int main(){
int t=1;
//scanf("%d",&t);
while(t--)Solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3788kb
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: 3748kb
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: 0
Accepted
time: 2ms
memory: 3792kb
input:
4 1 2 3 2 2 1 2 3
output:
Yes 2 2 3 3 1 1 2 2
result:
ok OK
Test #4:
score: 0
Accepted
time: 2ms
memory: 3720kb
input:
6 12 9 1 5 10 14 20 14 15 4 7 9
output:
Yes 15 4 25 14 10 9 15 14 1 5 7 11
result:
ok OK
Test #5:
score: 0
Accepted
time: 2ms
memory: 3704kb
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 2 36 -3 31
result:
ok OK
Test #6:
score: 0
Accepted
time: 2ms
memory: 3792kb
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 84 4 51 16 19 31 34 3 6 36 39
result:
ok OK
Test #7:
score: -100
Wrong Answer
time: 3ms
memory: 3792kb
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 997371369.5 135791685 997371370.5 135791684 997371370 135791683 997371371 135791684 997371370 135791678 997371369 135791677 997371370 135791676 997371368 135791674 997371369 135791684 997371370 135791685 997371369 135791679 997371373 135791683 997371369 135791677 997371370 135791678 997371369 13...
result:
wrong answer We have 4 point(s) in query 2