QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#389299#692. Delete the PointsSroundWA 0ms3904kbC++141.5kb2024-04-14 09:06:102024-04-14 09:06:10

Judging History

你现在查看的是最新测评结果

  • [2024-04-14 09:06:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3904kb
  • [2024-04-14 09:06:10]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

inline int read()
{
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0' || ch>'9') {if(ch=='-') f=1;ch=getchar();}
	while(ch>='0' && ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return f?-x:x;
}

#define x first
#define y second
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ull;
const int N=3010;

int n,top;
PII p[N],tmp;

int main()
{
	n=read();
	rep(i,1,n) p[i].x=read(),p[i].y=read();
	sort(p+1,p+1+n);
	
	puts("Yes"); top=0;
	for(int l=1,r=1;l<=n;l=r+1,r=l) {
		while(r<n && p[r+1].x==p[r].x) ++r;
		int i=l;
		for(;i+1<=r;) {
			int t=abs(p[i+1].y-p[i].y);
			if(top && (tmp.x>=p[i].x-t) && (tmp.y>=p[i].y && tmp.y<=p[i+1].y)) {
				if(p[i+1].y==tmp.y) {
					t=max(abs(p[i+1].y-tmp.y),abs(p[i+1].x-tmp.x));
					printf("%.4lf %.4lf %.4lf %.4lf\n",1.0*tmp.x,tmp.y+0.5,1.0*tmp.x+t,tmp.y-t+0.5);
					swap(p[i],p[i+1]); 
				}
				else {
					t=max(abs(p[i].y-tmp.y),abs(p[i].x-tmp.x));
					printf("%.4lf %.4lf %.4lf %.4lf\n",p[i].x+0.0,p[i].y-0.5,p[i].x-t+0.0,p[i].y+t-0.5);
				}
				top=0,i++;
			}
			else printf("%d %d %d %d\n",p[i].x,p[i].y,p[i].x-t,p[i+1].y),i+=2;
		}
		
		if(i==r) {
			if(!top) top=1,tmp=p[i];
			else {
				int t=max(abs(p[i].y-tmp.y),abs(p[i].x-tmp.x));
				printf("%d %d %d %d\n",p[i].x,p[i].y,p[i].x-t,p[i].y+(tmp.y<p[i].y?-1:1)*t);
				top=0,i++;
			}
		}
	}
	
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3836kb

input:

4
1 1
2 2
5 5
6 6

output:

Yes
2 2 1 1
6 6 5 5

result:

ok OK

Test #2:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

4
0 0
1 2
2 1
4 4

output:

Yes
1 2 -1 0
4 4 1 1

result:

ok OK

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3904kb

input:

4
1 2
3 2
2 1
2 3

output:

Yes
2.0000 0.5000 1.0000 1.5000
3 2 2 3

result:

wrong answer We have 1 point(s) in query 0