QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#433139#6639. Disk Treeucup-team3215WA 0ms3852kbC++20890b2024-06-08 05:03:092024-06-08 05:03:10

Judging History

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

  • [2024-06-08 05:03:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3852kb
  • [2024-06-08 05:03:09]
  • 提交

answer

#include <algorithm>
#include <array>
#include <iostream>
#include <set>
#include <vector>

using namespace std;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n; cin >> n;
  vector<array<int, 2>> ev;
  for (int i = 0; i < n; ++i) {
    int x, y, r; cin >> x >> y >> r;
    ev.push_back({min(y + r, (int)1e9), ~x});
    ev.push_back({y - r, x});
  }
  sort(ev.rbegin(), ev.rend());
  array<int, 2> dead{-1};
  multiset<int> live;
  cout << "YES\n";
  for (auto [y, x]: ev) {
    if (x >= 0) live.erase(live.find(x)), dead = {x, y};
    else if (auto it = live.insert(x = ~x); next(it) != live.end()) cout << x << ' ' << y << ' ' << *next(it) << ' ' << y << '\n';
    else if (it != live.begin()) cout << x << ' ' << y << ' ' << *prev(it) << ' ' << y << '\n';
    else if (~dead[0]) cout << x << ' ' << y << ' ' << dead[0] << ' ' << dead[1] << '\n';
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

input:

3
1 0 3
10 10 6
0 5 1

output:

YES
0 6 10 6
1 3 0 4

result:

ok answer = 1

Test #2:

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

input:

2
1 1 1
3 3 1

output:

YES
1 2 3 2

result:

ok answer = 1

Test #3:

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

input:

5
10 10 10
2 0 1
20 20 1
3 20 1
20 0 1

output:

YES
20 21 3 21
10 20 20 20
2 1 10 1
20 1 10 1

result:

ok answer = 1

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3632kb

input:

10
29 29 2
28 55 10
99 81 4
17 82 10
45 88 10
48 68 10
0 8 10
98 95 10
34 0 10
17 24 10

output:

YES
45 98 98 98
17 92 45 92
99 85 45 85
48 78 99 78
28 65 48 65
17 34 28 45
29 31 17 31
0 18 17 18
34 10 0 10

result:

wrong answer Two line segments intersect, and it's not only the endpoints that intersect or line segments intersects/touches more than 2 disks