QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#120469 | #692. Delete the Points | spoonjunxi | RE | 0ms | 0kb | C++14 | 1.8kb | 2023-07-06 18:41:48 | 2023-07-06 18:41:51 |
Judging History
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...