QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#389283#692. Delete the PointsSroundWA 1ms3956kbC++141.5kb2024-04-14 08:59:492024-04-14 08:59:49

Judging History

This is the latest submission verdict.

  • [2024-04-14 08:59:49]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3956kb
  • [2024-04-14 08:59:49]
  • Submitted

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,p[i+1].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("%d %d %d %d\n",p[i].x,p[i].y,p[i].x-t,p[i].y+t);
				}
				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: 3844kb

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: 3956kb

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: 0
Accepted
time: 1ms
memory: 3856kb

input:

4
1 2
3 2
2 1
2 3

output:

Yes
2 1 1 2
3 2 2 3

result:

ok OK

Test #4:

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

input:

6
12 9
1 5
10 14
20 14
15 4
7 9

output:

Yes
7 9 1 3
12 9 7 14
20 14 10 4

result:

ok OK

Test #5:

score: 0
Accepted
time: 1ms
memory: 3884kb

input:

10
39 72
59 52
23 17
2 31
30 0
25 88
2 36
61 23
4 96
59 76

output:

Yes
2 31 -3 36
23 17 -56 96
30 0 -58 88
59 52 39 72
61 23 8 76

result:

ok OK

Test #6:

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

input:

10
53 95
37 51
84 11
3 39
31 20
37 84
42 27
95 38
6 6
16 19

output:

Yes
6 6 -27 39
31 20 16 5
37 51 4 84
53 95 -15 27
95 38 68 11

result:

ok OK

Test #7:

score: -100
Wrong Answer
time: 1ms
memory: 3916kb

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
997371304 135791684 997371303 135791685
997371303.0000 135791709.5000 997371304.0000 135791708.5000
997371305 135791685 997371304 135791686
997371305 135791694 997371301 135791698
997371304.0000 135791708.5000 997371305.0000 135791707.5000
997371305 135791707 997371303 135791709
997371306 135791...

result:

wrong answer We have 3 point(s) in query 34