QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#319832#692. Delete the PointsxmbRE 0ms0kbC++141.6kb2024-02-03 10:34:312024-02-03 10:34:32

Judging History

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

  • [2024-02-03 10:34:32]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-02-03 10:34:31]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int t,n;
struct node{
	int x,y;
}mp[3010];
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";
				}
			}
		}
		xx=que.top();	que.pop();
		yy=que.top();	que.pop();
		cout<<0<<" "<<0<<" "<<1000000000<<" "<<1000000000<<"\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

4
1 1
2 2
5 5
6 6

output:


result: