QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#439502#6639. Disk Treeucup-team3215AC ✓186ms15860kbC++201.0kb2024-06-12 04:49:462024-06-12 04:49:47

Judging History

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

  • [2024-06-12 04:49:47]
  • 评测
  • 测评结果:AC
  • 用时:186ms
  • 内存:15860kb
  • [2024-06-12 04:49:46]
  • 提交

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 >> y >> x >> 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};
  set<int> live;
  cout << "YES\n";
  for (int i = 0; i < 2 * n; ++i) {
    if (auto [y, x] = ev[i]; x >= 0) live.erase(x), dead = {x, y};
    else if (auto it = live.insert(x = ~x).first; next(it) != live.end()) cout << y << ' ' << x << ' ' << y << ' ' << *next(it) << '\n';
    else if (it != live.begin()) {
      int j = i;
      while (i + 1 != 2 * n && ev[i + 1][0] == y && ~ev[i + 1][1] > *prev(it)) ++i;
      for (int k = i; cout << y << ' ' << ~ev[k][1] << ' ' << y << ' ' << *prev(it) << '\n', k > j; ) live.insert(~ev[k--][1]);
    } else if (~dead[0]) cout << y << ' ' << x << ' ' << dead[1] << ' ' << dead[0] << '\n';
  }
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3824kb

input:

3
1 0 3
10 10 6
0 5 1

output:

YES
0 0 0 5
4 10 4 0

result:

ok answer = 1

Test #2:

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

input:

2
1 1 1
3 3 1

output:

YES
2 3 2 1

result:

ok answer = 1

Test #3:

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

input:

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

output:

YES
1 0 1 10
2 20 2 10
19 20 19 10
19 0 19 10

result:

ok answer = 1

Test #4:

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

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
7 24 7 8
7 82 7 24
18 55 18 82
24 0 24 24
27 29 27 55
35 88 35 55
38 68 38 88
88 95 58 68
95 81 95 95

result:

ok answer = 1

Test #5:

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

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
0 663 0 773
0 520 0 663
0 366 0 520
0 179 0 366
0 13 0 179
7 952 7 773
20 607 20 663
39 843 39 952
60 703 60 773
63 850 63 952
64 226 64 366
75 790 75 850
81 208 81 226
100 115 100 208
111 603 111 703
120 512 120 603
129 156 129 366
134 241 134 366
176 100 176 241
179 934 179 703
198 323 198 512...

result:

ok answer = 1

Test #6:

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

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
0 6162 0 7670
0 4653 0 6162
0 2852 0 4653
0 1148 0 2852
55 7903 55 7670
87 9469 87 7903
113 8944 113 9469
139 3990 139 4653
178 7484 178 7670
265 51 265 1148
289 6779 289 7484
305 5282 305 6162
349 9349 349 9469
374 9493 374 9469
413 1890 413 2852
432 5542 432 6162
440 8185 440 8944
555 1954 555...

result:

ok answer = 1

Test #7:

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

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
0 79893 0 99921
0 69461 0 79893
0 58648 0 69461
0 39900 0 58648
0 24419 0 39900
0 16007 0 24419
110 7853 110 16007
414 91204 414 99921
548 90680 548 91204
1003 92828 1003 99921
1725 32550 1725 39900
2213 46829 2213 58648
3012 29001 3012 32550
3149 47905 3149 58648
3325 73213 3325 79893
3840 1703...

result:

ok answer = 1

Test #8:

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

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
0 816264930 0 918989948
0 769665792 0 816264930
0 713751639 0 769665792
0 673089475 0 713751639
0 595275379 0 673089475
0 553121854 0 595275379
0 500334319 0 553121854
0 429721563 0 500334319
0 359002653 0 429721563
0 235938924 0 359002653
0 93982006 0 235938924
992695 744294101 992695 769665792...

result:

ok answer = 1

Test #9:

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

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
0 922061437 0 980016231
0 859754220 0 922061437
0 800408068 0 859754220
0 768644389 0 800408068
0 726066771 0 768644389
0 700112363 0 726066771
0 675938444 0 700112363
0 651481700 0 675938444
0 640317017 0 651481700
0 604396696 0 640317017
0 563618993 0 604396696
0 493352547 0 563618993
0 433135...

result:

ok answer = 1

Test #10:

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

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
0 811122976 0 921644358
0 780877000 0 811122976
0 762343028 0 780877000
0 753305408 0 762343028
0 692058767 0 753305408
0 626815867 0 692058767
0 557279866 0 626815867
0 476455992 0 557279866
0 460091917 0 476455992
0 451638126 0 460091917
0 423205190 0 451638126
0 409308366 0 423205190
0 399848...

result:

ok answer = 1

Test #11:

score: 0
Accepted
time: 6ms
memory: 3968kb

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
0 9421 0 9972
0 9218 0 9421
0 9150 0 9218
0 9097 0 9150
0 9022 0 9097
0 8986 0 9022
0 8926 0 8986
0 8864 0 8926
0 8745 0 8864
0 8652 0 8745
0 7991 0 8652
0 7402 0 7991
0 7371 0 7402
0 7270 0 7371
0 7071 0 7270
0 6929 0 7071
0 6808 0 6929
0 6772 0 6808
0 6678 0 6772
0 6556 0 6678
0 6396 0 6556
0 ...

result:

ok answer = 1

Test #12:

score: 0
Accepted
time: 60ms
memory: 5248kb

input:

100000
956095525 596102106 2
461544095 587257542 118
884402350 357055086 14228
547768407 186052059 263162
827807425 303694996 474924
692537425 44608243 131609
504660936 451030143 15134
207539367 899608364 20283
919236289 724317925 6
386476373 727023405 323
781914406 792770865 1064
411548762 2476126 ...

output:

YES
0 742221667 0 827385510
0 707448235 0 742221667
0 674631883 0 707448235
0 646455574 0 674631883
0 643298905 0 646455574
0 616424636 0 643298905
0 571603990 0 616424636
0 427209090 0 571603990
0 333397542 0 427209090
0 312730895 0 333397542
0 304414580 0 312730895
0 266626847 0 304414580
0 114863...

result:

ok answer = 1

Test #13:

score: 0
Accepted
time: 120ms
memory: 7440kb

input:

200000
267774456 105702394 770
297991198 776424841 124
703700092 120262616 341808
212663821 221756923 367
195031049 705083745 66
692227605 63745620 1221
615879799 481139131 3053
93198187 239262367 141042
645539116 89213985 1679
312339485 547897747 2701
546940040 418847605 2
100457345 231142218 2
290...

output:

YES
0 915477723 0 955169182
0 901272788 0 915477723
0 752452219 0 901272788
0 737862129 0 752452219
0 716703493 0 737862129
0 635296273 0 716703493
0 608457934 0 635296273
0 599238912 0 608457934
0 593023526 0 599238912
0 576963616 0 593023526
0 565610129 0 576963616
0 558741222 0 565610129
0 541026...

result:

ok answer = 1

Test #14:

score: 0
Accepted
time: 111ms
memory: 7280kb

input:

200000
890760596 387635202 407021
845949678 865384827 250
298937825 444813049 30
257079208 603496538 24935
825947861 514433442 276
664047255 283065064 651111
481691537 759981944 616
953630211 233077236 207
716089940 174481709 876827
807394429 737990862 50258
9195111 176890156 946
209723712 839382384...

output:

YES
0 937419093 0 944024450
0 843223018 0 937419093
0 822840657 0 843223018
0 782623112 0 822840657
0 768378465 0 782623112
0 743940324 0 768378465
0 728865714 0 743940324
0 701321448 0 728865714
0 653898437 0 701321448
0 605883738 0 653898437
0 601372524 0 605883738
0 567697924 0 601372524
0 515225...

result:

ok answer = 1

Test #15:

score: 0
Accepted
time: 103ms
memory: 7340kb

input:

200000
21940906 14228149 878
947616612 637746482 278
490310177 117451293 1714712
278642428 651582650 1
214397046 727562852 3
314365021 93147008 158746
367463298 30253119 650745
816993648 678947261 4384
503557517 182822048 1116
61881753 989787068 109052
632366340 971129473 26
870552310 805607887 5436...

output:

YES
0 909859173 0 937003316
0 888922535 0 909859173
0 862923855 0 888922535
0 832579836 0 862923855
0 827181152 0 832579836
0 796860807 0 827181152
0 706053056 0 796860807
0 686039807 0 706053056
0 678899378 0 686039807
0 646589425 0 678899378
0 644634631 0 646589425
0 630035083 0 644634631
0 627202...

result:

ok answer = 1

Test #16:

score: 0
Accepted
time: 116ms
memory: 7276kb

input:

200000
81117 91365 1
68731 21152 3
37456 24002 2
37581 56006 3
52472 65837 1
68592 30967 2
37017 58189 11
21553 64504 95
94147 72332 80
82905 892 21
37593 40659 5
83451 10026 2
24925 11872 13
84418 48948 156
52378 43742 51
27379 10720 162
37042 54394 1
92324 20573 1
69506 96945 133
87826 40634 3
962...

output:

YES
0 96495 0 97476
0 95895 0 96495
0 94974 0 95895
0 94312 0 94974
0 93281 0 94312
0 92263 0 93281
0 90857 0 92263
0 90456 0 90857
0 88684 0 90456
0 86964 0 88684
0 85768 0 86964
0 85605 0 85768
0 84186 0 85605
0 82976 0 84186
0 82160 0 82976
0 79842 0 82160
0 79517 0 79842
0 79193 0 79517
0 78633 ...

result:

ok answer = 1

Test #17:

score: 0
Accepted
time: 3ms
memory: 3724kb

input:

10000
126758371 588314899 812231
238086622 378023315 890058
477126060 14900711 1191393
511712433 35095827 204725
651796639 43378716 2018310
308442866 596282834 2328087
42294570 231322805 1602825
168464157 357054887 2277954
224671652 693289331 2062259
616695889 175688410 1253251
385431057 29127383 18...

output:

YES
0 623894545 0 665955136
0 609955475 0 623894545
0 595760274 0 609955475
0 588341485 0 595760274
0 581792220 0 588341485
0 567925651 0 581792220
0 553473824 0 567925651
0 546698339 0 553473824
0 539688336 0 546698339
0 532358089 0 539688336
0 525136383 0 532358089
0 518013185 0 525136383
0 511684...

result:

ok answer = 1

Test #18:

score: 0
Accepted
time: 17ms
memory: 4208kb

input:

40000
290669648 662085507 804601
669033554 119055358 638805
105668336 570987547 641107
70398923 679676225 1151529
67163601 217283316 655911
266292842 490670500 288695
332954119 213678087 316383
133514562 301390490 1150957
189198028 430695918 498385
52533444 508154472 662055
675557474 175423882 71076...

output:

YES
0 686213860 0 696600618
0 682553261 0 686213860
0 679363627 0 682553261
0 672519529 0 679363627
0 668925461 0 672519529
0 658537225 0 668925461
0 655153378 0 658537225
0 647931359 0 655153378
0 644695003 0 647931359
0 641177160 0 644695003
0 637636882 0 641177160
0 634193436 0 637636882
0 630619...

result:

ok answer = 1

Test #19:

score: 0
Accepted
time: 47ms
memory: 5348kb

input:

79806
675311888 175949323 45152
668303725 415877398 705454
526993355 106652475 101518
306843353 465414670 733685
235164634 54490010 250702
237718215 128806833 416572
47406184 660535125 231461
217980403 334240174 311035
438155656 608919183 741482
175786440 138973185 691587
383453409 420621369 23780
1...

output:

YES
0 695299670 0 697609665
0 687977433 0 695299670
0 683018730 0 687977433
0 680383673 0 683018730
0 675665095 0 680383673
0 672830471 0 675665095
0 668236800 0 672830471
0 665461034 0 668236800
0 663045106 0 665461034
0 660751178 0 663045106
0 658032035 0 660751178
0 655971266 0 658032035
0 653182...

result:

ok answer = 1

Test #20:

score: 0
Accepted
time: 136ms
memory: 7452kb

input:

199809
330527920 105087498 120223
601378677 222559216 191284
604605920 449476822 241005
435487497 286817733 303877
682929431 10980946 280834
393289259 673421713 256371
217818174 324382996 403684
307178253 324362921 334561
321290021 314861063 288503
661144513 394874427 31218
664021225 319719526 14923...

output:

YES
0 695527477 0 698558996
0 693856034 0 695527477
0 692357180 0 693856034
0 690638815 0 692357180
0 689316579 0 690638815
0 684615037 0 689316579
0 682964487 0 684615037
0 681327276 0 682964487
0 679748204 0 681327276
0 675166396 0 679748204
0 671960201 0 675166396
0 670513128 0 671960201
0 668726...

result:

ok answer = 1

Test #21:

score: 0
Accepted
time: 91ms
memory: 7344kb

input:

200000
500000000 500000000 450000000
950000002 500000000 1
950000002 500014137 1
950000001 500028274 1
950000000 500042412 1
949999998 500056549 1
949999996 500070686 1
949999994 500084823 1
949999991 500098961 1
949999988 500113098 1
949999984 500127235 1
949999980 500141372 1
949999975 500155510 1...

output:

YES
49999997 500007069 49999997 500021206
49999997 499992931 49999997 500007069
49999997 499978794 49999997 499992931
49999998 500035343 49999998 500021206
49999998 499964657 49999998 499978794
50000000 500049480 50000000 500035343
50000000 500000000 50000000 500035343
50000000 499950520 50000000 49...

result:

ok answer = 1

Test #22:

score: 0
Accepted
time: 65ms
memory: 7292kb

input:

200000
1666 1666 1666
6664 1666 1666
11662 1666 1666
16660 1666 1666
21658 1666 1666
26656 1666 1666
31654 1666 1666
36652 1666 1666
41650 1666 1666
46648 1666 1666
51646 1666 1666
56644 1666 1666
61642 1666 1666
66640 1666 1666
71638 1666 1666
76636 1666 1666
81634 1666 1666
86632 1666 1666
91630 1...

output:

YES
4998 1666 3332 1666
9996 1666 8330 1666
14994 1666 13328 1666
19992 1666 18326 1666
24990 1666 23324 1666
29988 1666 28322 1666
34986 1666 33320 1666
39984 1666 38318 1666
44982 1666 43316 1666
49980 1666 48314 1666
54978 1666 53312 1666
59976 1666 58310 1666
64974 1666 63308 1666
69972 1666 683...

result:

ok answer = 1

Test #23:

score: 0
Accepted
time: 69ms
memory: 7288kb

input:

200000
1276 2177 1666
6143 1271 1666
12177 1577 1666
17105 1415 1666
21414 1758 1666
27078 1291 1666
31751 1856 1666
36681 2166 1666
42165 1914 1666
46298 2207 1666
51434 1925 1666
56782 1717 1666
61708 1408 1666
66612 1280 1666
71599 2168 1666
76405 1971 1666
81489 1694 1666
86696 2187 1666
91352 1...

output:

YES
4477 1271 2942 2177
10511 1577 7809 1271
15439 1415 13843 1577
19748 1758 18771 1415
25412 1291 23080 1758
30085 1856 28744 1291
35015 2166 33417 1856
40499 1914 38347 2166
44632 2207 43831 1914
49768 1925 47964 2207
55116 1717 53100 1925
60042 1408 58448 1717
64946 1280 63374 1408
69933 2168 68...

result:

ok answer = 1

Test #24:

score: 0
Accepted
time: 69ms
memory: 7460kb

input:

200000
1666 1666 1666
6588 2534 1666
11510 3402 1666
16432 4270 1666
21354 5138 1666
26276 6005 1666
31198 6873 1666
36120 7741 1666
41043 8609 1666
45965 9477 1666
50887 10345 1666
55809 11213 1666
60731 12081 1666
65653 12949 1666
70575 13817 1666
75497 14684 1666
80419 15552 1666
85341 16420 1666...

output:

YES
4922 2534 3332 1666
9844 3402 8254 2534
14766 4270 13176 3402
19688 5138 18098 4270
24610 6005 23020 5138
29532 6873 27942 6005
34454 7741 32864 6873
39377 8609 37786 7741
44299 9477 42709 8609
49221 10345 47631 9477
54143 11213 52553 10345
59065 12081 57475 11213
63987 12949 62397 12081
68909 1...

result:

ok answer = 1

Test #25:

score: 0
Accepted
time: 103ms
memory: 15772kb

input:

200000
1666 1666 1666
1666 6664 1666
1666 11662 1666
1666 16660 1666
1666 21658 1666
1666 26656 1666
1666 31654 1666
1666 36652 1666
1666 41650 1666
1666 46648 1666
1666 51646 1666
1666 56644 1666
1666 61642 1666
1666 66640 1666
1666 71638 1666
1666 76636 1666
1666 81634 1666
1666 86632 1666
1666 91...

output:

YES
0 999591670 0 999596668
0 999586672 0 999591670
0 999581674 0 999586672
0 999576676 0 999581674
0 999571678 0 999576676
0 999566680 0 999571678
0 999561682 0 999566680
0 999556684 0 999561682
0 999551686 0 999556684
0 999546688 0 999551686
0 999541690 0 999546688
0 999536692 0 999541690
0 999531...

result:

ok answer = 1

Test #26:

score: 0
Accepted
time: 186ms
memory: 15860kb

input:

200000
1238 1279 1666
1911 6266 1666
1278 11483 1666
1657 16880 1666
1637 22064 1666
1629 26455 1666
2087 31415 1666
1150 36477 1666
2020 41228 1666
1277 46249 1666
1331 51188 1666
1274 56871 1666
1709 61810 1666
1509 66281 1666
1922 71932 1666
2188 76257 1666
1947 81675 1666
2124 86511 1666
1231 91...

output:

YES
0 999582067 0 999591604
0 999577039 0 999582067
0 999561453 0 999577039
0 999556676 0 999561453
0 999551897 0 999556676
0 999536144 0 999551897
0 999516975 0 999536144
0 999506433 0 999516975
0 999501769 0 999506433
0 999491288 0 999501769
0 999476566 0 999491288
0 999466439 0 999476566
0 999461...

result:

ok answer = 1

Test #27:

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

input:

2
1000000000 1000000000 1000000000
0 0 1

output:

YES
0 0 0 1000000000

result:

ok answer = 1

Test #28:

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

input:

2
1000000000 1000000000 500000000
0 1000000000 499999999

output:

YES
500000000 1000000000 499999999 1000000000

result:

ok answer = 1

Test #29:

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

input:

2
0 1000000000 499999999
0 0 500000000

output:

YES
0 0 0 1000000000

result:

ok answer = 1

Test #30:

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

input:

2
1000000000 1000000000 499999999
1000000000 0 500000000

output:

YES
500000001 1000000000 500000001 0

result:

ok answer = 1