QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#120469#692. Delete the PointsspoonjunxiRE 0ms0kbC++141.8kb2023-07-06 18:41:482023-07-06 18:41:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-06 18:41:51]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-07-06 18:41:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int, int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for (;b;b>>=1) { if (b&1) res=res*a%mod; a=a*a%mod;} return res;}
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
// head

priority_queue<PII> pq; 

void plu(db a, db b, db l) {
	printf("%.2lf %.2lf %.2lf %.2lf\n", a, b, a + l, b - l);
}

void pld(db a, db b, db l) {
	printf("%.2lf %.2lf %.2lf %.2lf\n", a, b, a + l, b + l);
}

void solve() {
	int n;
	scanf("%d", &n);
	rep(i,0,n) {
		int x, y;
		scanf("%d%d", &x, &y);
		pq.push({x, y});	
	}

	puts("Yes");
	int cte = n / 2 - 1;
	while (cte--) {
		PII p = pq.top(); pq.pop();
		PII q = pq.top(); pq.pop();
		PII r = pq.top(); pq.pop();
		if (p.fi == q.fi) {
			pq.push(r);
			plu(p.fi, p.se, p.se - q.se);
		} else if (r.fi != q.fi) {
			pq.push(r);
			plu(q.fi, max(p.se, q.se), max(p.fi - q.fi, abs(q.se - p.se)));
		} else {
			if (p.se > r.se) {
				pq.push(r);
				pld(q.fi, min(p.se, q.se), max(p.fi - q.fi, q.se - p.se));
			} else if (p.se == r.se) {
				pq.push(p);
				pld((db)r.fi - 0.5, r.se, q.se - r.se);
			} else {
				pq.push(p);
				pld(r.fi, r.se, q.se - r.se);
			}
		}
	}

	PII p = pq.top(); pq.pop();
	PII q = pq.top(); pq.pop();
	pld(q.fi, min(p.se, q.se), max(p.fi - q.fi, abs(q.se - p.se)));
}

int _;
int main() {
	for (scanf("%d", &_); _; _--) {
		solve();
	}
}

详细

Test #1:

score: 0
Runtime Error

input:

4
1 1
2 2
5 5
6 6

output:

Yes
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2.00
1.00 2.00 1.00 2...

result: