QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#136055#6639. Disk TreeDelay_for_five_minutesAC ✓416ms45044kbC++202.1kb2023-08-06 20:34:382023-08-06 20:34:41

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-06 20:34:41]
  • 评测
  • 测评结果:AC
  • 用时:416ms
  • 内存:45044kb
  • [2023-08-06 20:34:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
struct ev {
    int x , p;
    int s; ///1 in , -1 out
    int id;
};
bool operator < (ev a,ev b)
{
    if(a.p == b.p) return a.s > b.s;
    return a.p < b.p;
}
multiset<ev> st;
set<pair<int,int> > cur ; ///x_pos , id
struct line {
    int x1,y1,x2,y2;
};
vector<line> ans;
int main()
{
   // freopen("in.txt","r",stdin);
   // ios::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
    cin >> n;
    for(int i =1;i <= n;i++) {
        int x , y , r;cin >> x >> y >> r;
        int l = max(0 , y - r) , R = min(1000000000 , y + r);
        st.insert((ev){x , l , 1 , i}) ;
        st.insert((ev){x , R , -1 , i});
    }
    int lsp = -1 , ls_s = -2;
    vector<ev> now;

    int lx = -1 , ly = -1;
    st.insert((ev){0 , 1000000001 , 1 , 0});
    for(auto  &E : st) {
        if((E.p != lsp || E.s != ls_s) && ls_s == 1) {
            int lm = 0;
            if(cur.size()) lm = cur.begin()->first;
            sort(now.begin() , now.end() , [&](ev x,ev y) {
                 if(x.x < lm && y.x < lm) return x.x > y.x;
                 return x.x < y.x;
                 });
            for(auto & cur_e : now) {
                if(!cur.size()) {
                    if(lx != -1) ans.push_back((line){lx , ly , cur_e.x , cur_e.p });
                }
                else {
                    //printf("add2\n");
                    auto it = cur.upper_bound(pair<int,int>{cur_e.x , 0}) ;
                    if(it != cur.begin()) it--;
                    ans.push_back((line){it->first , cur_e.p , cur_e.x , cur_e.p });
                }
                cur.insert(pair<int,int>{cur_e.x , cur_e.id });
            }
            now.clear();
        }
        if(E.s == 1) {
            now.push_back(E) ;
        }
        else {
            cur.erase(pair<int,int>{E.x , E.id });
            lx = E.x ; ly = E.p;
        }
        lsp = E.p ; ls_s = E.s;
    }
    cout << "YES\n";
    for(auto &s : ans) cout << s.x1 <<' ' << s.y1 <<' ' << s.x2 <<' ' << s.y2 << '\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 0 3
10 10 6
0 5 1

output:

YES
1 3 0 4
0 4 10 4

result:

ok answer = 1

Test #2:

score: 0
Accepted
time: 1ms
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: 3452kb

input:

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

output:

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

result:

ok answer = 1

Test #4:

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

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

result:

ok answer = 1

Test #5:

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

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
47 0 307 0
307 0 447 0
447 0 572 0
572 0 743 0
743 0 981 0
743 2 819 2
743 29 865 29
865 70 897 70
47 71 205 71
447 81 448 81
47 82 133 82
448 82 482 82
743 108 951 108
47 109 8 109
133 137 225 137
951 146 975 146
133 148 137 148
225 161 422 161
225 165 412 165
743 167 822 167
225 168 290 168
48...

result:

ok answer = 1

Test #6:

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

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

result:

ok answer = 1

Test #7:

score: 0
Accepted
time: 0ms
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
17439 0 29077 0
29077 0 41631 0
41631 0 59944 0
59944 0 77261 0
77261 0 91690 0
59944 136 68592 136
77261 184 84713 184
41631 664 52006 664
17439 851 9204 851
17439 1066 24210 1066
91690 1117 98474 1117
68592 3562 70020 3562
9204 4213 3750 4213
29077 4639 30900 4639
17439 4760 27055 4760
3750 54...

result:

ok answer = 1

Test #8:

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

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
20680215 0 113708920 0
113708920 0 141987231 0
141987231 0 172728107 0
172728107 0 226080097 0
226080097 0 299841077 0
299841077 0 403214718 0
403214718 0 465961807 0
465961807 0 514663175 0
514663175 0 563659908 0
563659908 0 621861762 0
621861762 0 667862689 0
667862689 0 707624813 0
707624813...

result:

ok answer = 1

Test #9:

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

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
2252230 0 108950037 0
108950037 0 200843132 0
200843132 0 222298247 0
222298247 0 249529924 0
249529924 0 266200344 0
266200344 0 317125332 0
317125332 0 439494346 0
439494346 0 584847362 0
584847362 0 641324357 0
641324357 0 672822472 0
672822472 0 789192278 0
789192278 0 897276291 0
897276291 ...

result:

ok answer = 1

Test #10:

score: 0
Accepted
time: 12ms
memory: 4452kb

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
49536879 0 134578061 0
134578061 0 235794912 0
235794912 0 331201192 0
331201192 0 409421203 0
409421203 0 475690214 0
475690214 0 567189171 0
567189171 0 658173809 0
658173809 0 687354759 0
687354759 0 699032270 0
699032270 0 711414638 0
711414638 0 723543058 0
723543058 0 746470787 0
746470787...

result:

ok answer = 1

Test #11:

score: 0
Accepted
time: 13ms
memory: 4940kb

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
8 0 893 0
893 0 1761 0
1761 0 1991 0
1991 0 2252 0
2252 0 2367 0
2367 0 2464 0
2464 0 2689 0
2689 0 2928 0
2928 0 3060 0
3060 0 3176 0
3176 0 3246 0
3246 0 3537 0
3537 0 3804 0
3804 0 4043 0
4043 0 4154 0
4154 0 5298 0
5298 0 6448 0
6448 0 6639 0
6639 0 6789 0
6789 0 6941 0
6941 0 7004 0
7004 0 ...

result:

ok answer = 1

Test #12:

score: 0
Accepted
time: 170ms
memory: 17688kb

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
32468243 0 36890840 0
36890840 0 86148715 0
86148715 0 146488302 0
146488302 0 270864139 0
270864139 0 281050892 0
281050892 0 346857351 0
346857351 0 491648562 0
491648562 0 513262647 0
513262647 0 533379128 0
533379128 0 602094279 0
602094279 0 661695387 0
661695387 0 726092697 0
726092697 0 8...

result:

ok answer = 1

Test #13:

score: 0
Accepted
time: 387ms
memory: 33856kb

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
70160830 0 82943885 0
82943885 0 97045810 0
97045810 0 144975483 0
144975483 0 173056277 0
173056277 0 178680294 0
178680294 0 253327407 0
253327407 0 267556510 0
267556510 0 273556249 0
273556249 0 336391199 0
336391199 0 376325542 0
376325542 0 427170649 0
427170649 0 431506274 0
431506274 0 4...

result:

ok answer = 1

Test #14:

score: 0
Accepted
time: 391ms
memory: 32488kb

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
43593450 0 96870259 0
96870259 0 104569016 0
104569016 0 217841810 0
217841810 0 254301450 0
254301450 0 346625811 0
346625811 0 389259624 0
389259624 0 476867414 0
476867414 0 479243958 0
479243958 0 587623617 0
587623617 0 603106148 0
603106148 0 612318368 0
612318368 0 634577817 0
634577817 0...

result:

ok answer = 1

Test #15:

score: 0
Accepted
time: 380ms
memory: 33032kb

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
8015087 0 43289069 0
43289069 0 123415093 0
123415093 0 131421990 0
131421990 0 142965385 0
142965385 0 148752315 0
148752315 0 151564251 0
151564251 0 185615346 0
185615346 0 187508531 0
187508531 0 207957345 0
207957345 0 220714506 0
220714506 0 227206566 0
227206566 0 255723258 0
255723258 0 ...

result:

ok answer = 1

Test #16:

score: 0
Accepted
time: 350ms
memory: 33120kb

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
2667 0 3785 0
3785 0 4052 0
4052 0 4395 0
4395 0 5359 0
5359 0 6161 0
6161 0 7631 0
7631 0 9349 0
9349 0 9657 0
9657 0 10662 0
10662 0 11024 0
11024 0 11364 0
11364 0 13274 0
13274 0 14016 0
14016 0 14537 0
14537 0 15160 0
15160 0 15772 0
15772 0 17657 0
17657 0 18586 0
18586 0 19852 0
19852 0 2...

result:

ok answer = 1

Test #17:

score: 0
Accepted
time: 16ms
memory: 4836kb

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
576934 0 7847300 0
7847300 0 14100833 0
14100833 0 21858874 0
21858874 0 28616367 0
28616367 0 35282901 0
35282901 0 56033530 0
56033530 0 63552609 0
63552609 0 70620018 0
70620018 0 98000219 0
98000219 0 106269883 0
106269883 0 119998762 0
119998762 0 126001288 0
126001288 0 134169600 0
1341696...

result:

ok answer = 1

Test #18:

score: 0
Accepted
time: 62ms
memory: 9192kb

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
4136009 0 7617693 0
7617693 0 10680873 0
10680873 0 14153369 0
14153369 0 18083450 0
18083450 0 21350887 0
21350887 0 24645227 0
24645227 0 28140016 0
28140016 0 35140298 0
35140298 0 42169037 0
42169037 0 49402932 0
49402932 0 52963568 0
52963568 0 59956327 0
59956327 0 63539431 0
63539431 0 66...

result:

ok answer = 1

Test #19:

score: 0
Accepted
time: 130ms
memory: 15192kb

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
220339 0 2525955 0
2525955 0 5062906 0
5062906 0 7519045 0
7519045 0 10108606 0
10108606 0 17779550 0
17779550 0 22436247 0
22436247 0 27464841 0
27464841 0 32453570 0
32453570 0 34823789 0
34823789 0 37493731 0
37493731 0 39597526 0
39597526 0 42269940 0
42269940 0 49502472 0
49502472 0 5212300...

result:

ok answer = 1

Test #20:

score: 0
Accepted
time: 400ms
memory: 34076kb

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
163701 0 3407437 0
3407437 0 4839335 0
4839335 0 6460181 0
6460181 0 9679745 0
9679745 0 11188885 0
11188885 0 12546513 0
12546513 0 14254525 0
14254525 0 15929983 0
15929983 0 17262977 0
17262977 0 18905340 0
18905340 0 20564093 0
20564093 0 21924005 0
21924005 0 25310312 0
25310312 0 26797246 ...

result:

ok answer = 1

Test #21:

score: 0
Accepted
time: 226ms
memory: 33908kb

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
499982328 49999997 499996466 49999997
499996466 49999997 500010603 49999997
499982328 49999998 499968191 49999998
500010603 49999998 500024740 49999998
499968191 49999999 499954054 49999999
500024740 49999999 500038877 49999999
499968191 50000000 500000000 50000000
500038877 50000000 500053015 5...

result:

ok answer = 1

Test #22:

score: 0
Accepted
time: 255ms
memory: 45044kb

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
1666 0 6664 0
6664 0 11662 0
11662 0 16660 0
16660 0 21658 0
21658 0 26656 0
26656 0 31654 0
31654 0 36652 0
36652 0 41650 0
41650 0 46648 0
46648 0 51646 0
51646 0 56644 0
56644 0 61642 0
61642 0 66640 0
66640 0 71638 0
71638 0 76636 0
76636 0 81634 0
81634 0 86632 0
86632 0 91630 0
91630 0 966...

result:

ok answer = 1

Test #23:

score: 0
Accepted
time: 416ms
memory: 42580kb

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
6143 0 12177 0
12177 0 17105 0
17105 0 27078 0
27078 0 61708 0
61708 0 66612 0
66612 0 96510 0
96510 0 101586 0
101586 0 112132 0
112132 0 131546 0
131546 0 136633 0
136633 0 141587 0
141587 0 146695 0
146695 0 151601 0
151601 0 171872 0
171872 0 181955 0
181955 0 186738 0
186738 0 201227 0
2012...

result:

ok answer = 1

Test #24:

score: 0
Accepted
time: 250ms
memory: 33584kb

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
1666 868 6588 868
6588 1736 11510 1736
11510 2604 16432 2604
16432 3472 21354 3472
21354 4339 26276 4339
26276 5207 31198 5207
31198 6075 36120 6075
36120 6943 41043 6943
41043 7811 45965 7811
45965 8679 50887 8679
50887 9547 55809 9547
55809 10415 60731 10415
60731 11283 65653 11283
65653 12151...

result:

ok answer = 1

Test #25:

score: 0
Accepted
time: 216ms
memory: 34352kb

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
1666 3332 1666 4998
1666 8330 1666 9996
1666 13328 1666 14994
1666 18326 1666 19992
1666 23324 1666 24990
1666 28322 1666 29988
1666 33320 1666 34986
1666 38318 1666 39984
1666 43316 1666 44982
1666 48314 1666 49980
1666 53312 1666 54978
1666 58310 1666 59976
1666 63308 1666 64974
1666 68306 166...

result:

ok answer = 1

Test #26:

score: 0
Accepted
time: 239ms
memory: 34352kb

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
1238 2945 1911 4600
1911 7932 1278 9817
1278 13149 1657 15214
1657 18546 1637 20398
1637 23730 1629 24789
1629 28121 2087 29749
2087 33081 1150 34811
1150 38143 2020 39562
2020 42894 1277 44583
1277 47915 1331 49522
1331 52854 1274 55205
1274 58537 1709 60144
1709 63476 1509 64615
1509 67947 192...

result:

ok answer = 1

Test #27:

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

input:

2
1000000000 1000000000 1000000000
0 0 1

output:

YES
0 0 1000000000 0

result:

ok answer = 1

Test #28:

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

input:

2
1000000000 1000000000 500000000
0 1000000000 499999999

output:

YES
1000000000 500000001 0 500000001

result:

ok answer = 1

Test #29:

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

input:

2
0 1000000000 499999999
0 0 500000000

output:

YES
0 500000000 0 500000001

result:

ok answer = 1

Test #30:

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

input:

2
1000000000 1000000000 499999999
1000000000 0 500000000

output:

YES
1000000000 500000000 1000000000 500000001

result:

ok answer = 1