QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#136052#6639. Disk TreeDelay_for_five_minutesWA 14ms4836kbC++201.9kb2023-08-06 20:25:442023-08-06 20:25:45

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:25:45]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:4836kb
  • [2023-08-06 20:25:44]
  • 提交

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) {
            sort(now.begin() , now.end() , [&](ev x,ev y) { 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.lower_bound(pair<int,int>{cur_e.x , 0}) ;
                    if(it == cur.end()) 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: 3476kb

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: 3520kb

input:

2
1 1 1
3 3 1

output:

YES
1 2 3 2

result:

ok answer = 1

Test #3:

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

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: 3508kb

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
48 78 45 78
99 85 98 85

result:

ok answer = 1

Test #5:

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

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

result:

ok answer = 1

Test #6:

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

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

result:

ok answer = 1

Test #7:

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

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

result:

ok answer = 1

Test #8:

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

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: 3936kb

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: 4464kb

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: -100
Wrong Answer
time: 14ms
memory: 4836kb

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:

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