QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595430#9177. String and Nailsfosov#AC ✓58ms4760kbC++14880b2024-09-28 13:42:082024-09-28 13:42:08

Judging History

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

  • [2024-09-28 13:42:08]
  • 评测
  • 测评结果:AC
  • 用时:58ms
  • 内存:4760kb
  • [2024-09-28 13:42:08]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;

#define ll long long 
#define INF 0x3f3f3f3f
#define LNF 0x3f3f3f3f3f3f3f3fll
#define MOD 998244353

#define N 10010

int main() {
#ifdef TEST
    freopen("zz.in", "r+", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n; cin >> n;
    vector<pair<int, int>> pts(n-1);
    int x0, y0; cin >> x0 >> y0;

    auto dis = [&](int x, int y) {
        return 1ll * (x - x0) * (x - x0) + 1ll * (y - y0) * (y - y0);
    };

    for (int i = 0; i < n-1; ++ i) {
        cin >> pts[i].first >> pts[i].second;
    }

    sort(pts.begin(), pts.end(), [&](auto& a, auto& b) {
        return dis(a.first, a.second) > dis(b.first, b.second);
    });
    
    cout << "YES\n";
    for (auto [x, y] : pts) {
        cout << x << ' ' << y << '\n';
    }

    return 0;
}


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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 1
2 4
3 1

output:

YES
2 4
3 1

result:

ok Everything ok

Test #2:

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

input:

1
1000000000 0

output:

YES

result:

ok Everything ok

Test #3:

score: 0
Accepted
time: 51ms
memory: 4600kb

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
828032037 688093945
827788028 688373699
827544019 688653453
827300010 688933207
827056001 689212961
826811992 689492715
827752283 687849936
826567983 689772469
827508274 688129690
826323974 690052223
827264265 688409444
826079965 690331977
827020256 688689198
825835956 690611731
826776247 688968...

result:

ok Everything ok

Test #4:

score: 0
Accepted
time: 44ms
memory: 4604kb

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
898232666 651412622
898010510 651767000
897788354 652121378
897566198 652475756
897344042 652830134
897121886 653184512
897878288 651190466
896899730 653538890
897656132 651544844
896677574 653893268
897433976 651899222
896455418 654247646
897211820 652253600
896233262 654602024
896989664 652607...

result:

ok Everything ok

Test #5:

score: 0
Accepted
time: 51ms
memory: 4684kb

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
779474246 444328954
779474246 444608708
779474246 444888462
779474246 445168216
779474246 445447970
779474246 445727724
779194492 444328954
779474246 446007478
779194492 444608708
779474246 446287232
779194492 444888462
779474246 446566986
779194492 445168216
779474246 446846740
779194492 445447...

result:

ok Everything ok

Test #6:

score: 0
Accepted
time: 35ms
memory: 4572kb

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
653939369 907398185
653898596 907413503
653857823 907428821
653817050 907444139
653776277 907459457
653735504 907474775
653694731 907490093
653653958 907505411
653613185 907520729
653572412 907536047
653531639 907551365
653490866 907566683
653450093 907582001
653409320 907597319
653368547 907612...

result:

ok Everything ok

Test #7:

score: 0
Accepted
time: 48ms
memory: 4660kb

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
564556639 189244529
564541099 189241308
564525559 189238087
564510019 189234866
564494479 189231645
564478939 189228424
564463399 189225203
564447859 189221982
564432319 189218761
564416779 189215540
564553418 189260069
564537878 189256848
564522338 189253627
564506798 189250406
564491258 189247...

result:

ok Everything ok

Test #8:

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

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
0 2
53 1
49 0
60 6
17 0
40 1
0 9
17 4
27 4
45 7
35 5
1 13
56 13
52 12
28 7
38 8
25 8
36 10
9 14
29 10
52 16
8 16
8 17
3 20
34 13
2 22
44 16
34 14
1 24
60 28
11 19
2 25
52 24
38 18
17 19
18 19
27 18
20 19
51 25
15 22
5 28
16 23
33 21
24 22
49 28
3 34
6 32
48 29
16 26
60 43
57 38
37 25
37 26
7 34
...

result:

ok Everything ok

Test #9:

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

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

result:

ok Everything ok

Test #10:

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

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
3 0
9 0
9 58
7 55
8 4
2 22
12 1
11 57
6 46
12 56
11 53
6 18
5 35
16 58
13 8
9 44
8 40
11 46
8 27
9 21
8 32
15 51
19 54
17 50
11 28
13 41
28 59
22 6
30 59
16 17
26 54
19 16
17 22
39 0
19 43
22 12
30 5
45 60
59 3
59 57
56 2
18 26
60 56
33 5
38 57
21 39
26 13
29 50
23 42
51 4
39 55
28 48
58 7
27 15...

result:

ok Everything ok

Test #11:

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

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
6 51
5 45
16 59
1 25
1 23
12 53
2 27
7 43
4 4
16 56
6 36
5 32
22 60
8 39
19 54
15 46
11 36
9 18
12 2
13 34
17 43
12 28
12 15
32 58
13 13
16 36
15 28
18 36
36 57
38 58
31 53
24 43
21 34
32 49
19 20
21 13
36 49
27 38
32 43
25 8
38 48
55 55
29 1
47 52
26 28
29 35
53 53
39 45
33 0
52 51
40 45
3...

result:

ok Everything ok

Test #12:

score: 0
Accepted
time: 46ms
memory: 4600kb

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
1 1
2 1
1 3
1 4
3 4
1 7
7 0
4 4
3 6
9 0
1 11
5 6
10 2
0 15
7 6
7 7
5 10
10 5
4 13
2 16
3 15
8 9
5 13
9 8
8 10
2 18
9 9
14 3
15 2
9 10
10 9
12 7
5 16
17 1
6 15
14 5
8 13
16 3
14 6
18 1
15 5
5 18
12 9
10 12
16 5
6 18
18 3
1 25
15 7
9 15
17 5
20 2
6 20
0 28
21 1
1 27
18 5
20 3
9 17
3 25
10 16
7 20
...

result:

ok Everything ok

Test #13:

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

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
1000 1
1000 2
998 2
999 3
1000 5
994 2
998 5
991 0
999 6
991 1
995 4
996 5
989 1
994 5
987 1
991 4
992 5
985 0
998 10
995 8
984 0
988 3
989 4
987 3
995 9
997 11
995 10
990 7
995 11
996 12
985 4
980 1
995 12
996 13
997 14
986 6
994 12
984 5
996 14
978 1
995 14
988 9
975 0
991 12
995 15
1000 19
97...

result:

ok Everything ok

Test #14:

score: 0
Accepted
time: 42ms
memory: 4600kb

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
0 0
1 0
0 3
1 3
3 1
3 2
4 1
3 3
5 0
4 2
5 1
4 3
6 0
1 8
6 1
5 3
4 5
5 5
2 10
4 7
8 1
9 0
8 2
0 15
7 4
3 11
10 0
9 2
4 10
8 4
0 17
5 9
7 6
11 0
6 8
5 10
9 4
8 6
10 3
0 19
7 8
8 7
2 17
4 14
8 8
0 21
2 18
1 20
6 12
7 11
4 16
3 18
10 7
1 22
6 14
3 19
15 0
8 11
2 21
14 2
11 7
15 1
0 25
11 8
0 26
2 23...

result:

ok Everything ok

Test #15:

score: 0
Accepted
time: 58ms
memory: 4608kb

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
823141 997427083
158419 995176273
1401772 993595289
1143662 992871561
2039088 993758917
3225421 995165372
6049580 998274018
590556 989130623
4599249 994874890
4190290 993418816
1677197 989304721
5045734 994093674
458560 986241999
1770848 987639277
1183034 986649311
8343289 997262008
5302819 9919...

result:

ok Everything ok

Test #16:

score: 0
Accepted
time: 54ms
memory: 4652kb

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
997416866 1587312
996054192 1530436
997918515 4745588
995031646 3948141
997795429 8811796
992232365 943432
996307321 7576701
998151009 10589581
991402209 216877
991606308 1218445
997439424 11362631
999843017 15423449
992674880 4233935
996526648 10539501
998106274 13273139
998623332 14117901
9920...

result:

ok Everything ok

Test #17:

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

input:

5
0 1000000000
1000000000 0
0 0
1000000000 1000000000
500000000 500000000

output:

YES
1000000000 0
0 0
1000000000 1000000000
500000000 500000000

result:

ok Everything ok

Test #18:

score: 0
Accepted
time: 50ms
memory: 4688kb

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
998008605 4015179
996237830 2324138
994387843 1351146
998172088 6185523
996738619 5165912
998434151 7448322
997288486 6427342
993655659 3237506
994953030 5933535
990033899 1105673
995541646 7215536
994506324 6441782
994550285 6849907
996036824 9894065
989250516 3232549
99147621...

result:

ok Everything ok

Test #19:

score: 0
Accepted
time: 54ms
memory: 4760kb

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
999156344 209893
997416116 519317
996935539 1024193
998249799 3270898
999062927 4291269
998284382 5183968
995817240 2934807
999110922 7632791
993513155 2352258
991442966 795336
999388594 9820984
993810902 4231774
999939814 10746000
999778107 10761731
991983871 2697395
997211996 10159575
99242976...

result:

ok Everything ok

Test #20:

score: 0
Accepted
time: 52ms
memory: 4652kb

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
792795 998327858
3344841 997969615
2200436 996234979
3276138 997220795
5410907 998068460
2732358 994384462
2274830 993742176
9168798 998805446
3472128 992033804
10402208 998767751
429723 988516084
9380856 996920533
8311286 995294260
6200265 993068737
257056 987071957
10233899 996723894
5012196 9...

result:

ok Everything ok

Test #21:

score: 0
Accepted
time: 50ms
memory: 4608kb

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
998683222 997025857
997528744 996699928
992913880 999656572
998581356 993270822
995503878 996509618
991840711 999829716
993167702 998145502
991005630 999785510
997732558 992046033
995522044 994387292
994821840 995153168
991022067 998098279
999606283 987709434
995162491 992499892
992321491 995140...

result:

ok Everything ok

Test #22:

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

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
595004828 404995172
584448736 404995172
595004828 415551264
595004828 426107356
573892644 404995172
584448736 415551264
595004828 436663448
563336552 404995172
573892644 415551264
584448736 426107356
595004828 447219540
552780460 404995172
563336552 415551264
584448736 436663448
573892644 426107...

result:

ok Everything ok

Test #23:

score: 0
Accepted
time: 58ms
memory: 4724kb

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
359400703 505199974
359403515 505199870
359404921 505199818
359405624 505199792
359407030 505199740
359408436 505199688
359409842 505199636
359411951 505199558
359414060 505199480
359416169 505199402
359417575 505199350
359418278 505199324
359418981 505199298
359422496 505199168
359423902 505199...

result:

ok Everything ok

Extra Test:

score: 0
Extra Test Passed