编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#100323 #1152. 连连看 Wrong Answer 70 2040 ms 2788 K C++ 17 (Clang) / 1.5 K Dytchem 2023-07-11 18:41:42
显示原始代码
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

pair<ll, pair<ll, ll>> ps[100000];

bool cmpx(pair<ll, pair<ll, ll>> p1, pair<ll, pair<ll, ll>> p2) { return p1.second.first < p2.second.first; }

bool cmpy(pair<ll, pair<ll, ll>> p1, pair<ll, pair<ll, ll>> p2) {
    return p1.second.second < p2.second.second;
}

int main() {
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    for (ll i = 0; i < n; ++i) {
        ll x, y;
        cin >> x >> y;
        ps[i].first = i + 1;
        ps[i].second.first = x - y;
        ps[i].second.second = x + y;
    }
    if (n % 2) {
        sort(ps, ps + n, cmpx);
        ll x0 = ps[(n - 1) / 2].second.first;
        sort(ps, ps + n, cmpy);
        ll y0 = ps[(n - 1) / 2].second.second;
        auto p = ps[0];
        for (auto& p1 : ps) {
            if (abs(p.second.first - x0) + abs(p.second.second - y0) >
                abs(p1.second.first - x0) + abs(p1.second.second - y0))
                p = p1;
        }

        sort(ps, ps + (n - 1) / 2, cmpx);
        sort(ps + (n - 1) / 2 + 1, ps + n, cmpx);

        cout << (n - 1) / 2 << endl;

        bool flag = true;
        for (int i = 0, j = n - 1; i < j; ++i, --j) {
            if (flag) {
                if (ps[i] == p) {
                    ++j;
                    flag = false;
                    continue;
                } else if (ps[j] == p) {
                    --i;
                    flag = false;
                    continue;
                }
            }
            cout << ps[i].first << ' ' << ps[j].first << endl;
        }
    }

    else {
        sort(ps, ps + n, cmpx);
        sort(ps, ps + n / 2, cmpy);
        sort(ps + n / 2, ps + n, cmpy);
        cout << n / 2 << endl;
        for (int i = 0, j = n - 1; i < j; ++i, --j) {
            cout << ps[i].first << ' ' << ps[j].first << endl;
        }
    }
}
子任务 #1
Wrong Answer
得分:70
测试点 #1
Accepted
得分:100
用时:115 ms
内存:2764 KiB

输入文件(input1.in

99994
39904 35083
46820 36679
18613 3814
6474 19631
37764 36525
18319 33414
45300 26489
21133 11529

<1155515 bytes omitted>

答案文件(input1.out

1665399942

用户输出

49997
24609 74276
10263 4144
45435 47842
77940 32460
72660 59179
88743 15280
665 83732
55100 38871
48629 62358
12798 79724
33042
<588736 bytes omitted>

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:93 ms
内存:2740 KiB

输入文件(input2.in

99966
29572 24605
33552 8402
18093 9640
547 31444
251 3309
43619 22874
32618 14747
3018 19766
37882 
<1155228 bytes omitted>

答案文件(input2.out

1664919648

用户输出

49983
82478 66426
62451 1892
40241 70187
44908 75051
98072 20286
72834 7395
17966 5804
79618 76988
85633 90317
75675 33995
35167
<588568 bytes omitted>

系统信息

Exited with return code 0
测试点 #3
Wrong Answer
得分:0
用时:98 ms
内存:2680 KiB

输入文件(input3.in

99959
24963 15592
20533 22230
22960 10397
32438 32270
16368 45627
25843 147
28835 6570
37998 16798
1
<1155287 bytes omitted>

答案文件(input3.out

1661963157

用户输出

49979
4285 63149
94700 56853
48843 74586
33401 55552
84221 3888
36056 82716
3469 4340
15378 96507
90590 58707
67172 77745
15826 
<588520 bytes omitted>

Special Judge 信息

Something is wrong...

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:109 ms
内存:2788 KiB

输入文件(input4.in

99950
2417 45567
19300 44813
23263 44027
33863 2702
39461 4555
42612 32590
15374 27421
31106 10493
4
<1155004 bytes omitted>

答案文件(input4.out

1662916373

用户输出

49975
83305 27199
60794 36598
92164 44732
63627 42473
91744 83003
71223 1366
66451 56615
35430 10886
52426 14298
20419 60786
553
<588472 bytes omitted>

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:96 ms
内存:2684 KiB

输入文件(input5.in

99972
45280 44508
29577 24171
8151 8714
7100 44734
49861 28412
31199 14196
17156 34102
32122 48695
4
<1155310 bytes omitted>

答案文件(input5.out

1664148272

用户输出

49986
10557 43572
33291 25429
77243 4825
68613 34086
10660 73730
84933 37773
41205 582
66778 26767
64098 84561
76924 20917
72325
<588604 bytes omitted>

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:115 ms
内存:2696 KiB

输入文件(input7.in

99994
22203 12731
48860 13276
9330 45678
45445 29249
15122 11965
11386 19038
21223 30977
15157 31632
<1155538 bytes omitted>

答案文件(input7.out

1665321412

用户输出

49997
17982 61291
50513 71218
80209 40472
96722 76694
4394 56697
41 29383
96351 31076
39246 82834
21574 11959
9306 66717
76198 1
<588736 bytes omitted>

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:84 ms
内存:2672 KiB

输入文件(input8.in

99994
8 4
10 6
4 4
6 9
7 5
9 5
10 8
8 3
2 7
2 10
10 2
2 10
9 9
6 7
5 4
8 4
3 10
10 8
7 5
8 5
10 8
8 
<419780 bytes omitted>

答案文件(input8.out

330146

用户输出

49997
53992 45906
23066 12325
84459 6013
71482 32338
82083 6017
52142 75542
70183 5503
21082 88666
66125 97342
880 32286
41393 6
<588736 bytes omitted>

系统信息

Exited with return code 0
测试点 #8
Wrong Answer
得分:0
用时:94 ms
内存:2760 KiB

输入文件(input9.in

99969
4 8
8 6
2 6
9 10
4 10
10 4
1 5
9 9
3 9
9 2
7 3
1 10
10 9
9 3
8 4
9 6
10 5
3 7
9 4
6 6
3 10
10 
<419576 bytes omitted>

答案文件(input9.out

329492

用户输出

49984
12142 38955
20279 47887
14904 91082
90741 62261
1114 47864
92459 96845
55242 76021
1123 77257
78826 6182
70579 52918
26593
<588580 bytes omitted>

Special Judge 信息

Something is wrong...

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:107 ms
内存:2672 KiB

输入文件(input10.in

99987
5 10
6 10
7 6
10 4
2 10
10 5
10 5
2 8
9 4
1 9
4 9
8 4
9 7
5 7
6 4
7 8
5 6
1 5
5 7
5 6
4 8
9 3

<419631 bytes omitted>

答案文件(input10.out

329440

用户输出

49993
32417 8568
83839 82812
81615 75544
1701 28716
19738 69298
19224 3755
42422 5512
40503 72728
53680 69270
75210 80112
55223 
<588688 bytes omitted>

系统信息

Exited with return code 0
测试点 #10
Wrong Answer
得分:0
用时:91 ms
内存:2752 KiB

输入文件(input11.in

99987
8 8
6 10
9 8
6 7
7 4
3 8
1 7
5 8
5 7
8 8
9 3
1 5
3 10
10 8
1 5
3 7
10 4
9 2
4 1
7 6
2 1
1 10
4
<419934 bytes omitted>

答案文件(input11.out

330047

用户输出

49993
12301 51007
75630 51831
73701 82653
45734 90236
73871 98690
25982 23476
8901 98536
23015 62141
29985 57629
75626 93499
803
<588688 bytes omitted>

Special Judge 信息

Something is wrong...

系统信息

Exited with return code 0
测试点 #11
Wrong Answer
得分:0
用时:92 ms
内存:2652 KiB

输入文件(input12.in

99991
1 9
6 6
8 9
8 9
10 10
3 7
8 10
4 5
3 6
6 10
3 8
7 7
1 6
7 1
9 2
3 1
6 7
7 10
5 4
7 3
8 9
3 3
1
<419968 bytes omitted>

答案文件(input12.out

330232

用户输出

49995
3113 19052
49382 18957
99301 61053
38366 88724
76760 4269
1585 28274
49675 18995
1773 19011
42113 36828
85336 38821
7919 6
<588712 bytes omitted>

Special Judge 信息

Something is wrong...

系统信息

Exited with return code 0
测试点 #12
Accepted
得分:100
用时:89 ms
内存:2692 KiB

输入文件(input13.in

99981
2 5
7 10
9 9
9 8
3 10
10 1
5 4
9 10
7 7
9 2
3 3
5 8
10 9
6 10
3 4
1 6
2 1
8 7
9 1
2 9
1 1
3 10
<419894 bytes omitted>

答案文件(input13.out

329860

用户输出

49990
14060 60667
38910 9249
44012 96367
59874 4171
85243 73880
12899 6708
64107 61051
38982 61028
84109 42887
64100 604
5869 98
<588652 bytes omitted>

系统信息

Exited with return code 0
测试点 #13
Accepted
得分:100
用时:93 ms
内存:2660 KiB

输入文件(input14.in

99970
2 6
8 5
4 5
4 7
6 9
1 8
2 7
6 6
3 8
1 3
5 5
10 8
10 2
3 9
4 4
2 6
1 9
9 8
7 8
1 7
5 6
6 5
10 3
<419547 bytes omitted>

答案文件(input14.out

329442

用户输出

49985
93737 48905
81682 91471
59412 48974
81691 37545
55303 7702
14425 33089
72917 82691
51499 19538
29262 88710
68646 91874
868
<588592 bytes omitted>

系统信息

Exited with return code 0
测试点 #14
Accepted
得分:100
用时:105 ms
内存:2692 KiB

输入文件(input15.in

99951
43016666 705054189
23890816 191954409
48367680 178083192
65698935 509772667
809449080 63876393
<1972731 bytes omitted>

答案文件(input15.out

33839316800310

用户输出

49975
36977 58865
31947 37680
93611 59487
62604 68454
96449 12963
2445 97013
59991 17130
55435 11867
14282 19681
44676 15212
745
<588473 bytes omitted>

系统信息

Exited with return code 0
测试点 #15
Accepted
得分:100
用时:112 ms
内存:2784 KiB

输入文件(input16.in

99950
390196982 16217026
756299460 557589375
845307426 215064985
403301484 72900781
989173256 503715
<1973044 bytes omitted>

答案文件(input16.out

33893190316304

用户输出

49975
2088 90857
63086 17222
33479 60702
10981 41561
84332 71978
69694 12463
67684 73347
70069 97030
39142 74988
79551 99672
377
<588472 bytes omitted>

系统信息

Exited with return code 0
测试点 #16
Accepted
得分:100
用时:100 ms
内存:2752 KiB

输入文件(input17.in

99966
309713742 103345138
912956589 605640153
759597371 959523157
958180894 12282372
124979541 33724
<1973228 bytes omitted>

答案文件(input17.out

33869086670134

用户输出

49983
91668 93291
26180 8771
30424 34438
8704 19876
29486 21712
31305 63112
52894 65536
91627 94376
56153 79743
28256 89037
2013
<588568 bytes omitted>

系统信息

Exited with return code 0
测试点 #17
Wrong Answer
得分:0
用时:105 ms
内存:2752 KiB

输入文件(input18.in

99989
662308788 188157881
945161135 936031796
224331765 646572957
176241418 73020933
141324820 14925
<1973587 bytes omitted>

答案文件(input18.out

33895043667584

用户输出

49994
3704 69208
4472 85185
71407 2128
9216 77912
19909 25863
23720 17885
46666 16572
77539 7971
47162 58637
64415 36672
18207 5
<588700 bytes omitted>

Special Judge 信息

Something is wrong...

系统信息

Exited with return code 0
测试点 #18
Accepted
得分:100
用时:120 ms
内存:2768 KiB

输入文件(input19.in

99973
154453232 656240272
715155228 848233937
852480696 275617197
561544202 123073069
472873249 7570
<1973611 bytes omitted>

答案文件(input19.out

33855972714822

用户输出

49986
65550 86753
83606 15585
48673 76107
86134 63161
93998 89506
90264 91421
81588 16024
37960 44574
6302 96368
25216 39816
647
<588604 bytes omitted>

系统信息

Exited with return code 0
测试点 #19
Accepted
得分:100
用时:107 ms
内存:2736 KiB

输入文件(input20.in

99963
330145838 658516321
110794903 347274671
457221490 32851628
825966653 737106317
215914215 91143
<1973595 bytes omitted>

答案文件(input20.out

33750931421773

用户输出

49981
50447 77030
49194 27180
42332 65127
55665 8736
88371 13215
96420 44563
16463 35387
5998 21473
62329 15576
52594 87317
1119
<588544 bytes omitted>

系统信息

Exited with return code 0
测试点 #20
Wrong Answer
得分:0
用时:115 ms
内存:2764 KiB

输入文件(input21.in

99955
645861926 798882887
204604371 64809073
832321434 183260368
540647278 28314156
852540009 437805
<1973031 bytes omitted>

答案文件(input21.out

33814666330789

用户输出

49977
65397 26765
58148 20297
77589 16021
16077 85820
11871 9944
85782 76248
98304 57979
2687 45878
28900 61350
20249 5573
57850
<588496 bytes omitted>

Special Judge 信息

Something is wrong...

系统信息

Exited with return code 0