QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#512108#9177. String and Nailsucup-team3661#AC ✓136ms6376kbC++20777b2024-08-10 13:33:072024-08-10 13:33:08

Judging History

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

  • [2024-08-10 13:33:08]
  • 评测
  • 测评结果:AC
  • 用时:136ms
  • 内存:6376kb
  • [2024-08-10 13:33:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;

int main() {
    int N;
    cin >> N;
    vector<pair<ll, ll>> P(N);
    for (auto& [x, y] : P) cin >> x >> y;

    auto a = P.back();
    P.pop_back();

    sort(P.begin(), P.end(), [&](auto u, auto v) {
        auto [xa, ya] = a;
        auto [xu, yu] = u;
        auto [xv, yv] = v;

        ll distu = (xa - xu) * (xa - xu) + (ya - yu) * (ya - yu);
        ll distv = (xa - xv) * (xa - xv) + (ya - yv) * (ya - yv);

        if (distu < distv) {
            return true;
        }
        return false;
    });

    ranges::reverse(P);

    cout << "YES" << '\n';
    for (auto [x, y] : P) cout << x << ' ' << y << '\n';
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

3
1 1
2 4
3 1

output:

YES
2 4
1 1

result:

ok Everything ok

Test #2:

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

input:

1
1000000000 0

output:

YES

result:

ok Everything ok

Test #3:

score: 0
Accepted
time: 122ms
memory: 6260kb

input:

200000
500000000 500000000
500244009 499720246
500488018 499440492
500732027 499160738
500976036 498880984
501220045 498601230
501464054 498321476
501708063 498041722
501952072 497761968
502196081 497482214
502440090 497202460
502684099 496922706
502928108 496642952
503172117 496363198
503416126 496...

output:

YES
500000000 500000000
500244009 499720246
500488018 499440492
500732027 499160738
500976036 498880984
501220045 498601230
500279754 500244009
501464054 498321476
500523763 499964255
501708063 498041722
500767772 499684501
501952072 497761968
501011781 499404747
502196081 497482214
501255790 499124...

result:

ok Everything ok

Test #4:

score: 0
Accepted
time: 125ms
memory: 6272kb

input:

200000
500000000 500000000
500222156 499645622
500444312 499291244
500666468 498936866
500888624 498582488
501110780 498228110
501332936 497873732
501555092 497519354
501777248 497164976
501999404 496810598
502221560 496456220
502443716 496101842
502665872 495747464
502888028 495393086
503110184 495...

output:

YES
500000000 500000000
500222156 499645622
500444312 499291244
500666468 498936866
500888624 498582488
501110780 498228110
500354378 500222156
501332936 497873732
500576534 499867778
501555092 497519354
500798690 499513400
501777248 497164976
501020846 499159022
501999404 496810598
501243002 498804...

result:

ok Everything ok

Test #5:

score: 0
Accepted
time: 121ms
memory: 6328kb

input:

200000
500000000 500000000
500000000 499720246
500000000 499440492
500000000 499160738
500000000 498880984
500000000 498601230
500000000 498321476
500000000 498041722
500000000 497761968
500000000 497482214
500000000 497202460
500000000 496922706
500000000 496642952
500000000 496363198
500000000 496...

output:

YES
500000000 500000000
500000000 499720246
500000000 499440492
500000000 499160738
500000000 498880984
500000000 498601230
500279754 500000000
500000000 498321476
500279754 499720246
500000000 498041722
500279754 499440492
500000000 497761968
500279754 499160738
500000000 497482214
500279754 498880...

result:

ok Everything ok

Test #6:

score: 0
Accepted
time: 121ms
memory: 6264kb

input:

200000
500000000 500000000
500040773 499984682
500081546 499969364
500122319 499954046
500163092 499938728
500203865 499923410
500244638 499908092
500285411 499892774
500326184 499877456
500366957 499862138
500407730 499846820
500448503 499831502
500489276 499816184
500530049 499800866
500570822 499...

output:

YES
500000000 500000000
500040773 499984682
500081546 499969364
500122319 499954046
500163092 499938728
500203865 499923410
500244638 499908092
500285411 499892774
500326184 499877456
500366957 499862138
500407730 499846820
500448503 499831502
500489276 499816184
500530049 499800866
500570822 499785...

result:

ok Everything ok

Test #7:

score: 0
Accepted
time: 121ms
memory: 6108kb

input:

200000
500000000 500000000
500003221 499984460
500006442 499968920
500009663 499953380
500012884 499937840
500016105 499922300
500019326 499906760
500022547 499891220
500025768 499875680
500028989 499860140
500032210 499844600
500035431 499829060
500038652 499813520
500041873 499797980
500045094 499...

output:

YES
500000000 500000000
500015540 500003221
500031080 500006442
500046620 500009663
500062160 500012884
500077700 500016105
500093240 500019326
500108780 500022547
500124320 500025768
500139860 500028989
500003221 499984460
500018761 499987681
500034301 499990902
500049841 499994123
500065381 499997...

result:

ok Everything ok

Test #8:

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

input:

100
29 58
10 60
7 34
47 47
48 29
37 25
30 42
47 32
60 28
0 2
53 1
42 32
3 34
52 24
45 7
32 60
40 1
15 22
60 43
17 19
17 54
24 22
21 38
37 26
11 46
18 59
27 18
11 19
34 14
8 16
50 38
29 10
34 59
5 28
14 36
34 41
57 53
25 8
17 0
35 5
60 52
36 10
38 8
50 41
38 18
45 39
44 16
33 21
18 19
51 25
35 58
49 ...

output:

YES
60 6
53 1
49 0
40 1
56 13
0 2
45 7
52 12
17 0
35 5
52 16
27 4
38 8
17 4
60 28
0 9
28 7
36 10
25 8
44 16
29 10
52 24
1 13
34 13
51 25
60 43
34 14
57 38
60 52
38 18
9 14
49 28
8 16
48 29
57 53
53 38
56 48
52 36
8 17
3 20
27 18
54 60
47 32
33 21
50 38
2 22
11 19
20 19
17 19
18 19
37 25
43 30
50 41
...

result:

ok Everything ok

Test #9:

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

input:

100
42 46
57 9
21 58
30 46
43 25
43 31
15 28
33 8
31 28
48 26
47 54
57 13
33 11
4 1
5 0
28 45
4 10
9 56
54 49
6 20
49 22
33 43
31 15
42 56
51 15
3 29
46 23
22 29
49 50
16 20
60 48
41 16
42 53
14 41
17 45
31 6
50 19
6 0
57 50
36 40
29 34
0 33
52 59
17 7
37 23
20 31
8 14
56 28
2 53
44 3
54 18
22 59
53...

output:

YES
2 1
5 0
4 1
6 0
4 9
4 10
11 9
10 10
23 1
8 14
17 7
0 29
32 0
6 20
7 19
0 33
3 29
10 18
45 1
12 17
10 21
22 10
36 4
2 53
44 3
2 47
31 6
49 4
33 8
38 7
20 16
16 20
51 7
57 9
12 29
33 11
60 11
9 56
15 28
36 12
12 36
31 15
57 13
36 14
17 30
14 38
59 16
13 46
14 41
51 15
14 51
41 16
30 21
20 31
57 18...

result:

ok Everything ok

Test #10:

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

input:

100
47 30
32 14
26 29
13 41
45 17
42 34
56 2
11 57
11 28
39 0
40 47
19 43
59 57
21 39
33 45
16 17
17 22
60 42
39 55
52 18
28 48
42 6
44 48
56 29
26 40
41 31
43 40
24 32
9 44
41 23
30 5
30 36
36 35
22 12
6 46
57 44
9 21
25 29
3 0
18 26
25 35
29 50
23 42
43 15
58 49
37 10
42 30
8 40
6 18
8 27
30 44
47...

output:

YES
59 3
56 2
58 7
51 4
39 0
56 19
42 6
52 18
3 0
9 0
48 15
33 5
12 1
30 5
44 14
56 29
44 15
37 10
60 42
43 15
45 17
60 56
8 4
22 6
59 57
53 31
51 28
58 49
57 44
13 8
32 14
47 30
26 13
22 12
41 23
53 52
49 36
27 15
44 30
41 27
42 30
19 16
41 31
47 47
42 34
16 17
46 48
6 18
45 60
43 40
44 48
42 41
34...

result:

ok Everything ok

Test #11:

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

input:

100
60 19
19 20
36 57
54 36
40 17
45 45
32 49
58 41
47 28
26 28
38 48
39 24
24 43
30 8
53 45
12 2
35 30
54 19
33 0
36 24
60 8
2 27
1 25
0 59
13 13
47 52
22 60
6 36
54 51
25 8
52 51
57 9
39 45
51 41
6 51
32 43
52 40
57 39
4 4
36 6
9 18
21 13
50 1
50 33
38 29
31 53
47 37
56 45
53 21
13 34
1 23
42 18
3...

output:

YES
0 59
4 4
1 23
1 25
2 27
12 2
6 51
5 45
5 32
6 36
7 43
9 18
8 39
12 53
12 15
16 59
13 13
16 56
11 36
12 28
13 34
15 46
22 60
19 54
15 28
29 1
17 43
16 36
21 13
25 8
19 20
33 0
18 36
31 5
30 7
30 8
21 34
32 58
24 43
36 6
35 7
44 1
31 53
48 0
26 28
31 15
36 57
50 1
27 38
38 58
48 2
32 49
43 6
29 35...

result:

ok Everything ok

Test #12:

score: 0
Accepted
time: 76ms
memory: 6304kb

input:

200000
658 517
723 846
391 133
564 468
633 202
556 954
760 456
151 969
436 184
984 490
896 355
871 985
101 474
136 92
220 747
833 272
839 145
783 485
78 888
819 829
177 209
233 546
709 414
105 273
955 945
748 593
182 181
160 645
532 327
491 354
512 24
190 152
147 539
476 300
474 289
478 772
157 853
...

output:

YES
4 1000
4 997
0 992
4 996
1 993
9 1000
3 994
0 989
7 996
5 994
3 992
4 993
8 996
7 995
3 991
9 996
7 994
12 998
0 986
11 997
1 986
2 987
3 988
6 991
15 999
14 998
0 984
13 997
11 995
9 993
3 986
10 993
4 987
8 991
7 990
18 1000
0 982
14 996
4 986
19 999
15 995
12 992
1 980
13 992
8 987
9 988
4 98...

result:

ok Everything ok

Test #13:

score: 0
Accepted
time: 83ms
memory: 6212kb

input:

200000
378 842
689 0
407 360
925 706
35 241
517 296
157 365
379 630
234 828
370 628
28 136
367 483
546 638
995 367
901 983
479 253
812 610
454 878
250 0
618 535
221 325
346 583
470 440
997 887
197 643
613 711
687 194
468 519
837 984
844 159
220 857
101 701
120 531
391 802
361 11
519 944
370 285
766 ...

output:

YES
0 999
1 1000
0 997
1 998
3 999
0 995
1 996
2 997
4 999
1 994
7 1000
2 994
6 998
0 991
5 996
2 992
1 990
4 993
6 995
4 992
7 995
8 996
9 997
4 991
11 998
12 999
4 990
10 995
11 996
13 998
5 989
11 995
13 997
3 986
13 996
16 999
6 988
18 1000
0 981
4 985
5 986
13 994
1 981
2 982
3 983
5 985
7 986
...

result:

ok Everything ok

Test #14:

score: 0
Accepted
time: 81ms
memory: 6124kb

input:

200000
860 546
26 774
422 975
277 563
812 661
98 259
937 887
599 299
41 472
376 385
154 919
855 361
229 191
472 22
572 217
506 227
15 75
116 501
803 733
799 860
893 53
459 238
223 848
127 889
821 952
105 439
182 960
529 12
761 640
824 576
920 681
631 241
85 531
314 542
240 734
933 124
972 710
593 79...

output:

YES
998 1000
1000 998
1000 997
1000 996
996 998
998 995
997 994
991 999
1000 991
990 999
991 998
993 996
997 992
991 997
998 991
1000 989
998 990
993 994
994 993
985 1000
998 989
999 988
999 987
993 992
989 995
984 999
998 986
992 991
993 990
981 1000
982 999
988 994
983 998
997 986
998 985
995 987
...

result:

ok Everything ok

Test #15:

score: 0
Accepted
time: 135ms
memory: 6268kb

input:

200000
824175840 488750041
893673855 438646868
506562578 184637200
761446161 4953165
923499503 652902113
817153029 230202371
946810300 303530617
906604390 328096095
697686565 540398115
228789229 425571938
208244496 326466740
966638889 820582012
90257817 655318977
216563076 98765025
574316317 6924138...

output:

YES
999436779 1164850
997016850 1163940
996114303 2668507
996640748 4287233
995692505 3375659
998763907 7049160
992688784 878336
995555061 4446194
999357754 8750682
994724248 4546860
997575575 7592954
992611746 3289276
998442700 10089638
989890998 1729992
993353173 7051566
997348309 11493626
9866059...

result:

ok Everything ok

Test #16:

score: 0
Accepted
time: 135ms
memory: 6328kb

input:

200000
1433020 626069928
229180372 161196849
900502139 7107082
972307164 933305447
771737287 191739450
323730061 8183918
949678944 490542724
523994382 985258262
953870673 374422949
96559137 217074405
627267233 174567394
573638149 400359707
141414987 321531687
809839237 701887439
316867805 708592231
...

output:

YES
921288 999573764
1225757 998836357
3309259 999139881
1470045 997711737
4072845 998871152
1521512 996308700
5307243 998675529
544272 994526702
2511528 995438157
7180637 998392017
7552139 997012983
2614273 993129291
9413709 998195684
3675661 993531099
1041081 991512284
4932644 993389741
5962249 99...

result:

ok Everything ok

Test #17:

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

input:

5
0 1000000000
1000000000 0
0 0
1000000000 1000000000
500000000 500000000

output:

YES
1000000000 1000000000
0 0
1000000000 0
0 1000000000

result:

ok Everything ok

Test #18:

score: 0
Accepted
time: 135ms
memory: 6268kb

input:

200000
178690201 763389816
228250401 473681415
925845481 534609673
814571948 566690436
30040488 435609496
125274385 81132757
247514879 898893195
67755446 273824208
841458560 282076711
669361754 713609582
46289970 432733465
107008482 685170111
487539449 987744399
108148105 83671488
722982805 72477062...

output:

YES
999226352 3625203
996237830 2324138
994387843 1351146
998008605 4015179
998172088 6185523
996738619 5165912
993655659 3237506
990033899 1105673
997288486 6427342
998434151 7448322
994953030 5933535
994506324 6441782
995541646 7215536
994550285 6849907
989250516 3232549
983819678 406649
991476212...

result:

ok Everything ok

Test #19:

score: 0
Accepted
time: 131ms
memory: 6376kb

input:

200000
60980090 900709703
858724210 491198688
319785041 430708482
25432950 790010009
878278273 384512251
926818709 490518084
176754595 380872594
685145439 562390155
24013739 116101546
537131662 136515830
833908927 617270608
8975034 264947807
833663911 990393598
406456974 391826610
170567002 74094902...

output:

YES
997388441 999226773
999515086 992099845
995084768 997837650
995987382 996608709
996270200 995804881
995944982 996051261
996934566 991960337
998164987 990129296
992601358 996021675
992844110 995505588
995162368 992445048
999178752 986355055
998848928 986613267
988775399 999574863
998560381 986250...

result:

ok Everything ok

Test #20:

score: 0
Accepted
time: 131ms
memory: 6188kb

input:

200000
943269980 38029589
857794239 582344890
713724603 253178364
572730442 718362290
726516058 923349589
728363033 563466923
179623240 789223065
933939212 555988811
575165138 655159089
404901571 633051007
957964373 170403969
910941587 918354431
884821081 656606308
999733135 363545243
281714710 9784...

output:

YES
722043 1917226
2552686 745293
3337935 1632411
4101610 1985582
5167853 1075537
2535495 3581464
5283628 2700381
611006 6925014
4985252 3289154
5171762 4290069
4073735 5666422
3489024 6856057
977229 9291943
11856528 1121999
9913121 2833844
3818875 8432670
10517918 3506013
10005409 4103044
8179473 5...

result:

ok Everything ok

Test #21:

score: 0
Accepted
time: 135ms
memory: 6192kb

input:

200000
415494452 470316769
193300756 599862164
34035236 780680955
709962518 351747279
279786550 167219634
529907356 46481178
477459176 271202463
182732984 844554758
757720317 857780143
977704188 129586183
376987109 723537332
107875431 498132126
230945542 322819018
298042004 376733073
319233490 99464...

output:

YES
1405783 996920620
5760644 998983893
1983544 996406519
7126000 998371788
5522461 996916387
6536272 997366053
4532944 995479711
8680200 997868143
6854161 996765383
5166269 995466420
2957704 993519714
8659194 996833251
4474539 993952757
7420417 995496999
5545657 994205263
10134593 996437521
8921882...

result:

ok Everything ok

Test #22:

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

input:

100
500000000 500000000
500000000 489443908
500000000 478887816
500000000 468331724
500000000 457775632
500000000 447219540
500000000 436663448
500000000 426107356
500000000 415551264
500000000 404995172
510556092 500000000
510556092 489443908
510556092 478887816
510556092 468331724
510556092 457775...

output:

YES
500000000 500000000
500000000 489443908
510556092 500000000
500000000 478887816
521112184 500000000
510556092 489443908
500000000 468331724
531668276 500000000
521112184 489443908
510556092 478887816
542224368 500000000
500000000 457775632
531668276 489443908
510556092 468331724
521112184 478887...

result:

ok Everything ok

Test #23:

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

input:

200000
571121104 497369632
424233472 502802176
635651583 494983014
459708961 501490138
627796261 495273538
615283564 495736312
535668814 498680812
639758509 494831122
592923243 496563294
523187049 499142442
426839493 502705794
378712816 504485728
394223105 503912090
581741325 496976850
619310348 495...

output:

YES
640600000 494800000
640599297 494800026
640597891 494800078
640594376 494800208
640592267 494800286
640588049 494800442
640587346 494800468
640586643 494800494
640584534 494800572
640583128 494800624
640581722 494800676
640581019 494800702
640580316 494800728
640579613 494800754
640578910 494800...

result:

ok Everything ok

Extra Test:

score: 0
Extra Test Passed