QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#326088 | #692. Delete the Points | pjshwa | WA | 1ms | 3616kb | C++14 | 1.2kb | 2024-02-12 11:04:12 | 2024-02-12 11:04:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
void fast_io() {
cin.tie(nullptr)->sync_with_stdio(false);
}
void solve() {
int N; cin >> N;
map<int, vector<int>> F;
for (int i = 0; i < N; ++i) {
int x, y; cin >> x >> y;
F[y].push_back(x);
}
vector<tuple<int, int, int, int>> ans;
vector<pair<int, int>> R;
for (auto& [y, xv] : F) {
sort(xv.begin(), xv.end());
int Z = xv.size();
for (int i = 1; i < Z; i += 2) {
int x1 = xv[i - 1], x2 = xv[i];
int len = x2 - x1;
ans.emplace_back(x1, y - len, x2, y);
}
if (Z & 1) R.emplace_back(xv.back(), y);
}
assert(R.size() % 2 == 0);
for (int i = 0; i < R.size(); i += 2) {
auto [x1, y1] = R[i]; auto [x2, y2] = R[i + 1];
assert(y1 < y2);
int maxx = max(x1, x2), minx = min(x1, x2);
int len = max(maxx - minx, y2 - y1);
ans.emplace_back(maxx - len, y2 - len, maxx, y2);
}
cout << "Yes\n";
for (auto [x1, y1, x2, y2] : ans) {
cout << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << '\n';
}
}
int main() {
fast_io();
int t = 1;
// cin >> t;
while (t--) solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3556kb
input:
4 1 1 2 2 5 5 6 6
output:
Yes 1 1 2 2 5 5 6 6
result:
ok OK
Test #2:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
4 0 0 1 2 2 1 4 4
output:
Yes 0 -1 2 1 1 1 4 4
result:
ok OK
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3616kb
input:
4 1 2 3 2 2 1 2 3
output:
Yes 1 0 3 2 0 1 2 3
result:
wrong answer We have 3 point(s) in query 0