QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#433140#6639. Disk Treeucup-team3215WA 6ms3856kbC++20881b2024-06-08 05:09:052024-06-08 05:09:07

Judging History

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

  • [2024-06-08 05:09:07]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:3856kb
  • [2024-06-08 05:09:05]
  • 提交

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({max(y - r, 0), ~x});
    ev.push_back({y + r, x});
  }
  sort(ev.begin(), ev.end());
  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: 3564kb

input:

3
1 0 3
10 10 6
0 5 1

output:

YES
10 4 1 3
0 4 10 4

result:

ok answer = 1

Test #2:

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

input:

2
1 1 1
3 3 1

output:

YES
3 2 1 2

result:

ok answer = 1

Test #3:

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

input:

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

output:

YES
10 0 20 0
2 0 10 0
20 19 10 19
3 19 10 19

result:

ok answer = 1

Test #4:

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

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
0 0 34 0
17 14 0 14
29 27 17 27
28 45 17 34
48 58 28 58
17 72 48 72
99 77 48 77
45 78 48 78
98 85 99 85

result:

ok answer = 1

Test #5:

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

input:

100
490 783 12
666 460 55
561 245 6
223 323 25
3 520 77
225 161 24
514 190 16
997 914 100
412 265 100
374 610 36
296 854 39
601 901 2
307 21 100
390 422 24
940 414 32
332 438 35
553 992 100
235 775 3
656 901 37
770 417 22
649 305 100
448 84 3
375 939 77
910 847 9
776 357 37
743 97 100
371 502 39
508...

output:

YES
743 0 981 0
572 0 743 0
447 0 572 0
307 0 447 0
47 0 307 0
819 2 981 2
865 29 981 29
897 70 981 70
205 71 307 71
448 81 572 81
482 82 572 82
133 82 205 82
951 108 981 108
8 109 47 109
225 137 482 137
975 146 951 146
137 148 225 148
422 161 482 161
412 165 422 165
822 167 743 167
290 168 412 168
...

result:

ok answer = 1

Test #6:

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

input:

200
2948 9798 687
3897 647 35
3918 587 28
1262 2717 206
1315 9524 20
2381 305 1000
4344 6858 20
6234 8949 53
5168 4772 85
5044 6109 158
72 7670 132
7300 1213 837
5427 2263 1000
1785 3009 276
6136 1421 43
1629 5620 29
6445 9489 242
8443 3141 1000
4118 4307 63
1874 5238 291
1964 5785 73
7794 3934 18
3...

output:

YES
7552 0 8844 0
7051 0 7552 0
6112 0 7051 0
2381 0 6112 0
833 0 2381 0
4163 46 6112 46
7251 124 7552 124
4278 164 6112 164
7602 273 8844 273
4775 279 6112 279
7300 376 7602 376
147 442 833 442
3446 497 4775 497
3918 559 4775 559
3731 606 3918 606
3897 612 3918 612
3427 706 3446 706
3984 750 4775 7...

result:

ok answer = 1

Test #7:

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

input:

300
42942 37079 222
49441 21821 1695
61023 31153 561
86630 26307 352
36940 78253 213
7841 81086 626
47425 22290 374
17694 68695 648
38259 64794 998
43599 46942 9662
9204 2816 1965
38652 83568 4057
4046 29001 1034
72591 63214 587
75984 64859 1112
70005 72177 576
34522 52126 652
56627 48785 1747
78820...

output:

YES
77261 0 91690 0
59944 0 77261 0
41631 0 59944 0
29077 0 41631 0
17439 0 29077 0
68592 136 77261 136
84713 184 91690 184
52006 664 59944 664
9204 851 17439 851
24210 1066 29077 1066
98474 1117 91690 1117
70020 3562 77261 3562
3750 4213 9204 4213
30900 4639 41631 4639
27055 4760 29077 4760
7778 54...

result:

ok answer = 1

Test #8:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

1000
558504245 246224785 100000000
971981730 913036757 1821458
198791767 482624549 5998171
540520619 353988177 8924682
183178222 46223569 9859905
118485076 22129062 7497235
274928891 417171180 372954
230079763 468235825 289869
859092765 562864738 5551376
129036518 743777318 3969979
265158223 3092933...

output:

YES
883484446 0 982269559 0
798603733 0 883484446 0
707624813 0 798603733 0
667862689 0 707624813 0
621861762 0 667862689 0
563659908 0 621861762 0
514663175 0 563659908 0
465961807 0 514663175 0
403214718 0 465961807 0
299841077 0 403214718 0
226080097 0 299841077 0
172728107 0 226080097 0
14198723...

result:

ok answer = 1

Test #9:

score: 0
Accepted
time: 2ms
memory: 3684kb

input:

3000
442876143 334276354 3627270
526253918 947313397 2498956
566692880 229330019 4243066
497859604 658736917 13012787
315969653 65582717 1400013
394215653 932651144 1655676
58249045 973232518 860150
860773683 959388251 1594726
23803673 921365885 5926749
730359196 818999592 1521282
971839312 22835235...

output:

YES
925660458 0 985143181 0
909964683 0 925660458 0
897276291 0 909964683 0
789192278 0 897276291 0
672822472 0 789192278 0
641324357 0 672822472 0
584847362 0 641324357 0
439494346 0 584847362 0
317125332 0 439494346 0
266200344 0 317125332 0
249529924 0 266200344 0
222298247 0 249529924 0
20084313...

result:

ok answer = 1

Test #10:

score: 0
Accepted
time: 4ms
memory: 3708kb

input:

7000
601805179 978984160 464352
918208048 607538668 2214109
328147216 806677103 3901695
961794394 719893281 1114470
453816635 992288784 274949
778724702 692479905 1170018
169287513 886715521 576156
812072299 118324465 93778
726229729 150105801 3593039
368683874 642143790 1277375
40087476 151799345 4...

output:

YES
988974395 0 999863170 0
977428113 0 988974395 0
876718689 0 977428113 0
756298825 0 876718689 0
746470787 0 756298825 0
723543058 0 746470787 0
711414638 0 723543058 0
699032270 0 711414638 0
687354759 0 699032270 0
658173809 0 687354759 0
567189171 0 658173809 0
475690214 0 567189171 0
40942120...

result:

ok answer = 1

Test #11:

score: -100
Wrong Answer
time: 6ms
memory: 3696kb

input:

10000
645 4710 5
1554 4072 7
6505 2760 1
6125 8212 11
9802 9537 3
6584 4356 6
1104 6649 23
4580 2623 20
3107 2460 1
4689 1662 2
7815 161 14
8718 3658 28
2900 63 15
1741 7296 44
8380 4608 50
2212 8514 4
7919 3069 17
1638 6057 3
504 9867 18
7869 8021 14
866 9239 5
3452 8042 4
9049 7222 4
4447 1004 5
9...

output:

YES
9487 0 9998 0
8972 0 9487 0
8846 0 8972 0
8671 0 8846 0
8641 0 8671 0
8573 0 8641 0
8430 0 8573 0
8367 0 8430 0
8189 0 8367 0
8086 0 8189 0
8050 0 8086 0
7984 0 8050 0
7815 0 7984 0
7722 0 7815 0
7695 0 7722 0
7600 0 7695 0
7481 0 7600 0
7377 0 7481 0
7363 0 7377 0
7004 0 7363 0
6941 0 7004 0
67...

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