QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#180621#4301. Points and SegmentsSorahISAAC ✓89ms6620kbC++203.9kb2023-09-16 02:12:222023-09-16 02:12:23

Judging History

This is the latest submission verdict.

  • [2023-09-16 02:12:23]
  • Judged
  • Verdict: AC
  • Time: 89ms
  • Memory: 6620kb
  • [2023-09-16 02:12:22]
  • Submitted

answer

#ifndef Yamada
#define Yamada
#include Yamada __FILE__ Yamada

pii operator + (pii a, pii b) {return pii(a.X + b.X, a.Y + b.Y);}
pii operator - (pii a, pii b) {return pii(a.X - b.X, a.Y - b.Y);}
int dot(pii a, pii b) {return a.X * b.X + a.Y * b.Y;}
int cross(pii a, pii b) {return a.X * b.Y - a.Y * b.X;}
int sign(int x) {return clamp(x, int(-1), int(+1));}
int ori(pii a, pii b, pii c) {return sign(cross(b-a, c-a));}
bool coll(pii a, pii b, pii c) {return (ori(a, b, c) == 0);}
bool btw(pii a, pii b, pii c) {return (coll(a, b, c) ? (sign(dot(a-c, b-c)) <= 0) : 0);}
bool seg_intersect(pii a, pii b, pii c, pii d) {
    int a123 = ori(a, b, c), a124 = ori(a, b, d), a341 = ori(c, d, a), a342 = ori(c, d, b);
    if (a123 == 0 and a124 == 0) return (btw(a, b, c) or btw(a, b, d) or btw(c, d, a) or btw(c, d, b));
    return (a123 * a124 < 0 and a341 * a342 < 0);
}

int hull_size(vector<pii> dots) {
    sort(ALL(dots));
    vector<pii> ans{dots[0]};
    for (int ct = 0; ct < 2; ++ct, reverse(ALL(dots))) {
        for (int i = 1, t = SZ(ans); i < SZ(dots); ans.eb(dots[i++])) {
            while (SZ(ans) > t and ori(end(ans)[-2], end(ans)[-1], dots[i]) <= 0) ans.pb();
        }
    }
    return SZ(ans) - 1;
}

void solve() {
    int N; cin >> N;
    
    vector<pii> pts(N);
    for (auto &[x, y] : pts) cin >> x >> y;
    
    /// E = 3n - |CV| - 3 ///
    
    int E = 3*N - hull_size(pts) - 3;
    // debug(E);
    
    set<pii> alives;
    for (int i = 0; i < N; ++i) {
        for (int j = i+1; j < N; ++j) alives.ee(i, j);
    }
    
    auto rem = [&](int i, int j) -> void {
        auto it = begin(alives);
        while (it != end(alives)) {
            while (it != end(alives) and seg_intersect(pts[i], pts[j], pts[it->first], pts[it->second])) {
                // debug(i, j, it->first, it->second);
                it = alives.erase(it);
            }
            if (it != end(alives)) it = next(it);
        }
    };
    
    if (E % 2 == 1) {
        cout << 1 << "\n" << flush;
    }
    else {
        cout << 2 << "\n" << flush;
        int i, j; cin >> i >> j;
        rem(i-1, j-1);
    }
    
    while (SZ(alives)) {
        auto [i, j] = *begin(alives);
        cout << i+1 << " " << j+1 << "\n" << flush;
        rem(i, j);
        cin >> i >> j;
        if (i == 0 and j == 0) return;
        rem(i-1, j-1);
    }
}

signed main() {
    IOS();
    int t = 1; // cin >> t;
    for (int i = 1; i <= t; ++i) solve();
    return 0;
}

#else

#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#define int int64_t
// #define double __float80
using pii = pair<int, int>;
template <typename T> using MaxHeap = std::priority_queue<T>;
template <typename T> using MinHeap = std::priority_queue<T, vector<T>, greater<T>>;

#define X first
#define Y second
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define SZ(a) (int)((a).size())
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)

#ifdef local
#define IOS() void()
#define debug(...) \
    fprintf(stderr, "%sAt [%s], line %d: (%s) = ", "\u001b[33m", __FUNCTION__, __LINE__, #__VA_ARGS__), \
    _do(__VA_ARGS__), fprintf(stderr, "%s", "\u001b[0m")
template <typename T> void _do(T &&_t) {cerr << _t << "\n";}
template <typename T, typename ...U> void _do(T &&_t, U &&..._u) {cerr << _t << ", ", _do(_u...);}
#else
#define IOS() ios_base::sync_with_stdio(0); cin.tie(0)
#define debug(...) void()
#define endl '\n'
#endif

// mt19937_64 rng(steady::chrono_clock::now().time_since_epoch().count());

template <typename T, typename U> bool chmin(T &lhs, U rhs) {return lhs > rhs ? lhs = rhs, 1 : 0;}
template <typename T, typename U> bool chmax(T &lhs, U rhs) {return lhs < rhs ? lhs = rhs, 1 : 0;}

#endif

詳細信息

Test #1:

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

input:

3
0 0
10 0
0 10
1 3
0 0

output:

1
1 2
2 3

result:

ok 3 turns

Test #2:

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

input:

4
0 0
10 0
5 7
5 3
1 2
1 4
2 4
0 0

output:

2
1 3
2 3
3 4

result:

ok 6 turns

Test #3:

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

input:

5
2 -1
9 -10
5 -9
-4 1
0 -9
1 2
1 4
2 3
3 5
0 0

output:

2
1 3
1 5
2 5
4 5

result:

ok 8 turns

Test #4:

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

input:

5
-2 -10
-4 -9
10 -2
10 5
-10 6
4 5
3 5
3 4
0 0

output:

1
1 2
1 3
1 5
2 5

result:

ok 7 turns

Test #5:

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

input:

5
-10 3
4 -5
-5 -3
-9 5
-4 -6
1 3
2 3
2 4
2 5
0 0

output:

2
1 2
1 4
1 5
3 5

result:

ok 8 turns

Test #6:

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

input:

10
9 9
-10 5
10 9
1 2
0 -8
-8 1
6 4
-4 1
0 3
-8 4
1 2
1 4
1 6
1 8
1 10
2 10
4 5
4 8
5 6
5 8
6 10
0 0

output:

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

result:

ok 22 turns

Test #7:

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

input:

10
2 4
-3 9
-1 -6
-5 6
-10 6
0 -6
0 -7
10 2
9 -9
-5 3
9 10
8 10
8 9
7 10
7 9
6 10
6 9
6 7
5 10
5 7
0 0

output:

1
1 2
1 4
1 5
1 8
1 10
2 4
2 5
2 8
3 5
3 7
4 5

result:

ok 21 turns

Test #8:

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

input:

10
-2 -4
-3 -7
0 1
-4 10
-4 -1
8 -8
-10 3
7 10
4 0
-5 -5
2 10
3 6
2 4
7 10
8 9
4 5
5 7
3 8
4 8
6 9
0 0

output:

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

result:

ok 21 turns

Test #9:

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

input:

5
-5427 -8607
-5083 -6829
-3163 -8076
3104 -6859
2674 -6268
1 2
1 4
2 5
3 5
0 0

output:

2
1 3
1 5
3 4
4 5

result:

ok 8 turns

Test #10:

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

input:

5
-2844 -291
-7853 8025
707 9407
3253 -2613
-7442 -8223
4 5
3 4
2 5
2 3
0 0

output:

2
1 2
1 3
1 4
1 5

result:

ok 8 turns

Test #11:

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

input:

5
-5378 -2274
-5505 5735
-7983 1772
-1716 1633
-4998 -5061
1 3
2 3
2 4
4 5
0 0

output:

2
1 2
1 4
1 5
3 5

result:

ok 8 turns

Test #12:

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

input:

10
5841 -2290
-2916 3621
7383 -9230
-6329 7632
8706 1029
4564 -4078
8164 -7170
-9548 -6315
-1021 -6517
2113 5667
1 3
1 5
1 7
1 9
2 4
3 6
3 8
4 8
5 7
6 9
0 0

output:

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

result:

ok 21 turns

Test #13:

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

input:

10
-4135 6025
-568 -6112
-1306 -4306
-9037 -8123
-1410 -8368
9922 -2029
1742 -4431
1882 -939
-8952 -149
4410 -8327
8 10
7 10
7 8
6 10
6 8
5 10
5 7
4 9
4 5
3 5
0 0

output:

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

result:

ok 21 turns

Test #14:

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

input:

10
-6669 -3400
-8519 -960
303 -6824
-1446 -3877
1034 -5206
7839 4606
5618 -4548
8131 4437
858 -3484
-5852 7384
2 10
3 6
6 7
4 5
6 8
3 7
6 10
7 8
5 6
6 9
0 0

output:

2
1 2
1 3
1 4
1 5
1 6
1 9
1 10
3 5
4 9
5 9

result:

ok 20 turns

Test #15:

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

input:

30
8391 2008
-1431 4658
8251 5989
5201 1088
7131 -371
2843 -7737
4564 4603
7561 1319
-9154 -2370
6945 504
7036 5971
5298 1486
-1414 9508
1383 9012
5916 3803
1083 1067
-4078 -2682
-3518 5411
4494 5120
6774 -8227
-6412 -1698
-2521 6972
948 7829
5073 -5969
-4231 3045
-8854 5070
-6317 -1671
-2821 -5939
...

output:

2
1 3
1 5
1 7
1 9
1 11
1 13
1 15
1 17
1 19
1 21
1 23
1 25
1 27
1 29
2 18
3 11
4 9
4 21
5 24
6 20
6 28
7 15
8 10
9 12
9 17
9 25
9 27
9 30
11 14
13 14
13 18
13 23
14 19
16 25
17 28
18 26
20 24
25 29
26 30

result:

ok 78 turns

Test #16:

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

input:

30
5857 26
-9381 2368
-438 3471
232 -2108
-2984 -2326
8201 -5689
8440 4487
-8452 6695
2916 -5705
-3317 3656
-5319 5378
636 5166
298 9408
-8515 -7545
9303 5774
-591 6413
944 -643
4768 8873
-6203 9828
5743 -5190
-5104 -657
2544 2490
-6623 -270
-1697 -6022
-1435 8584
6191 7898
-7577 -7774
7612 2775
992...

output:

2
1 2
1 3
1 4
1 5
1 6
1 8
1 9
1 10
1 11
1 12
1 16
1 17
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 29
2 8
2 10
2 14
2 23
2 27
3 8
3 11
3 19
3 22
4 5
4 24
5 17
5 21
5 24
6 20
6 29
7 15
7 26

result:

ok 78 turns

Test #17:

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

input:

30
-4119 8341
-7033 7519
1170 -1903
380 2138
-541 836
6118 -6496
2018 7226
5239 -7930
5284 8106
6422 9664
-7377 -4918
-6882 5990
9452 7048
1588 -6362
9833 -4814
-5122 1460
5966 8839
3351 -3080
3100 7094
4711 3028
6501 3241
-4949 -6578
-6753 4190
-8466 -6075
-6081 8941
-6208 428
5983 -3578
-9398 1192...

output:

2
1 2
1 4
1 5
1 7
1 9
1 10
1 12
1 17
1 19
1 25
2 12
2 25
2 28
3 5
3 6
3 17
3 18
3 23
3 26
4 5
4 7
4 9
4 17
4 19
6 8
6 13
6 14
6 15
6 20
6 28
7 19
8 15
8 29
10 17
10 25
11 28
12 23
13 15
24 29

result:

ok 78 turns

Test #18:

score: 0
Accepted
time: 4ms
memory: 4100kb

input:

100
8859 -8961
7843 980
-5453 2187
-9656 6656
1450 -1804
-276 -2979
-3613 -7038
8940 -815
-5372 -5190
5567 -1306
-766 2965
-4074 -4714
-7059 1943
4161 6838
9494 -5664
-6665 4904
8770 -3193
-8228 7949
316 4037
-2481 7223
-6597 -1811
-3003 3074
-1495 4752
-9750 9479
-4188 -5387
-9430 -4839
-5936 -6848...

output:

1
1 2
1 4
1 6
1 8
1 10
1 12
1 14
1 16
1 18
1 20
1 22
1 24
1 26
1 28
1 30
1 32
1 34
1 36
1 38
1 40
1 42
1 44
1 46
1 48
1 50
1 52
1 54
1 56
1 58
1 60
1 62
1 64
1 66
1 68
1 70
1 72
1 74
1 76
1 78
1 80
1 82
1 84
1 86
1 88
1 90
1 92
1 94
1 96
1 98
1 100
2 86
3 37
3 56
4 16
4 24
4 40
4 63
4 80
4 88
5 40
6...

result:

ok 285 turns

Test #19:

score: 0
Accepted
time: 4ms
memory: 3876kb

input:

100
-1117 1616
-2368 6131
5859 7111
-2066 -9099
-5809 1358
7939 -3786
264 3143
2630 4561
6698 1179
7864 -5596
-2824 110
-4150 6408
-5347 -418
-5737 8021
-9976 6605
-8340 -2310
4090 6288
-9645 8555
2178 -6139
3929 7998
7270 -8212
9505 -5994
8674 1769
-9078 9426
-8834 2413
5615 5430
-7195 -2653
-4355 ...

output:

2
1 2
1 3
1 5
1 7
1 8
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 20
1 24
1 25
1 27
1 28
1 29
1 32
1 33
1 34
1 39
1 40
1 45
1 48
1 51
1 52
1 53
1 55
1 56
1 57
1 58
1 63
1 64
1 65
1 67
1 68
1 70
1 79
1 80
1 82
1 83
1 84
1 87
1 89
1 91
1 100
2 34
2 65
3 8
3 26
3 29
3 48
3 86
3 100
4 10
4 21
4 22
4 35
4 ...

result:

ok 284 turns

Test #20:

score: 0
Accepted
time: 4ms
memory: 4128kb

input:

100
8908 -367
-2877 -6457
7467 -7966
5524 2589
4076 -8038
-6703 -1737
6401 3026
-824 7081
9066 -2156
-9840 -2444
4822 -483
-8812 -210
3807 -518
-3076 1762
852 -3983
9986 5297
3995 8327
6083 -542
-1077 830
2898 5918
6317 -7170
2012 4939
1103 3373
-3288 9373
4260 510
5775 8258
6365 -8756
6078 -1333
52...

output:

2
1 2
1 3
1 4
1 5
1 7
1 9
1 14
1 16
1 17
1 19
1 20
1 21
1 22
1 23
1 25
1 28
1 29
1 30
1 32
1 34
1 36
1 37
1 39
1 40
1 44
1 45
1 49
1 52
1 54
1 55
1 56
1 57
1 58
1 65
1 66
1 67
1 71
1 73
1 74
1 76
1 77
1 78
1 79
1 87
1 89
1 98
1 99
2 10
2 15
2 18
2 28
2 37
2 43
2 53
2 56
2 57
2 59
2 65
2 88
2 100
3 2...

result:

ok 282 turns

Test #21:

score: 0
Accepted
time: 14ms
memory: 5088kb

input:

200
170 8522
2874 -7333
-3009 -7209
-1442 -3854
5327 -9363
3712 9839
-1245 -2931
-1322 2337
-7429 6776
905 -7924
946 604
6029 -6387
3770 1653
-4956 4741
-5484 -3625
-640 3249
5515 -5927
-9259 5868
-5818 5078
-9974 5597
5833 -7650
-2331 -4421
1301 5109
5294 9451
7111 8512
8445 1019
2345 2478
608 2887...

output:

2
1 3
1 5
1 7
1 9
1 11
1 13
1 15
1 17
1 19
1 21
1 23
1 25
1 27
1 29
1 31
1 33
1 35
1 37
1 39
1 41
1 43
1 45
1 47
1 49
1 51
1 53
1 55
1 57
1 59
1 61
1 63
1 65
1 67
1 69
1 71
1 73
1 75
1 77
1 79
1 81
1 83
1 85
1 87
1 89
1 91
1 93
1 95
1 97
1 99
1 101
1 103
1 105
1 107
1 109
1 111
1 113
1 115
1 117
1 1...

result:

ok 580 turns

Test #22:

score: 0
Accepted
time: 11ms
memory: 4800kb

input:

200
-9806 6540
-5076 -9624
-1401 -9728
-4149 392
7770 1242
1629 1590
-7667 -3048
4927 7713
4641 -9118
-9357 -1916
8591 11
-1489 -2707
-4816 1553
5147 3068
-7215 -3915
-2315 -9146
834 3554
9325 9330
-9073 -5098
8995 8634
9997 3690
2735 -6047
4028 -2990
-8917 1956
9907 6609
8606 3847
-6356 -769
3599 8...

output:

2
1 2
1 3
1 7
1 10
1 15
1 16
1 19
1 24
1 27
1 30
1 33
1 35
1 37
1 43
1 44
1 47
1 49
1 50
1 54
1 56
1 57
1 67
1 68
1 70
1 73
1 74
1 82
1 89
1 92
1 99
1 102
1 109
1 112
1 113
1 115
1 116
1 131
1 140
1 141
1 165
1 180
1 185
1 186
1 189
1 192
1 200
2 3
2 16
2 50
2 93
2 99
2 102
2 113
2 131
2 141
2 192
3...

result:

ok 582 turns

Test #23:

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

input:

200
219 4557
-2728 -2211
9911 -4804
3441 4638
-9787 -8155
-454 783
-6647 -308
-3644 -6912
7008 -2749
382 1236
-6025 -583
1291 8415
4338 8896
2692 4251
-6685 5499
-1729 -3800
5856 -1849
5052 -2622
231 -7832
7964 -3150
-1254 -2711
7801 4886
-3543 1470
-8245 1903
5261 -5593
3649 -5884
-5355 570
6590 71...

output:

2
1 2
1 3
1 4
1 6
1 7
1 9
1 10
1 11
1 14
1 15
1 17
1 18
1 20
1 21
1 22
1 23
1 27
1 28
1 29
1 30
1 37
1 39
1 41
1 43
1 48
1 49
1 50
1 52
1 57
1 61
1 63
1 70
1 72
1 76
1 79
1 84
1 86
1 87
1 90
1 94
1 96
1 97
1 99
1 100
1 101
1 102
1 104
1 105
1 110
1 112
1 114
1 119
1 123
1 124
1 125
1 126
1 130
1 133...

result:

ok 584 turns

Test #24:

score: 0
Accepted
time: 32ms
memory: 6316kb

input:

300
1778 3148
167 9472
6876 3395
3917 7897
6347 818
7700 -4785
1122 -6266
975 8345
216 6183
-6613 3198
-9901 7946
-3869 -5204
4300 -8935
3072 -211
-5579 -3847
-2058 -3587
7377 -8661
9711 -3654
5788 -1322
5389 -3470
8560 4252
3459 8085
-5606 3206
-7104 -7722
8112 2409
-8565 -565
-9375 4362
-1736 -576...

output:

2
1 3
1 5
1 7
1 9
1 11
1 13
1 15
1 17
1 19
1 21
1 23
1 25
1 27
1 29
1 31
1 33
1 35
1 37
1 39
1 41
1 43
1 45
1 47
1 49
1 51
1 53
1 55
1 57
1 59
1 61
1 63
1 65
1 67
1 69
1 71
1 73
1 75
1 77
1 79
1 81
1 83
1 85
1 87
1 89
1 91
1 93
1 95
1 97
1 99
1 101
1 103
1 105
1 107
1 109
1 111
1 113
1 115
1 117
1 1...

result:

ok 880 turns

Test #25:

score: 0
Accepted
time: 30ms
memory: 6620kb

input:

300
4361 -8538
2514 4325
1043 8319
-6233 -416
8790 -8578
5617 6966
-5299 -6382
-5335 3423
2584 -9711
-4315 9206
-2256 -89
8614 5918
-6547 -9034
-6825 972
-2193 -1875
-3732 1759
-2421 -6622
-4266 7250
2533 8503
4358 7008
2425 8149
-4034 -983
6824 7666
6128 -7775
3466 506
-962 2263
4185 1115
1255 96
8...

output:

1
1 2
1 3
1 4
1 5
1 8
1 9
1 10
1 11
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 36
1 39
1 40
1 43
1 45
1 46
1 48
1 50
1 52
1 53
1 54
1 55
1 58
1 61
1 62
1 64
1 65
1 66
1 68
1 70
1 72
1 73
1 74
1 76
1 77
1 79
1 80
1 81
1 82
1 83
1 85
1 87
1 88
1 89
1 90
1 91...

result:

ok 881 turns

Test #26:

score: 0
Accepted
time: 24ms
memory: 6612kb

input:

300
1828 2039
2006 2035
-7647 -4497
8799 3830
-8767 -5416
-9025 6159
-4279 3799
-1347 -3760
2095 -3343
-7135 -7643
3129 9616
-8606 9598
-4835 -9134
3278 -702
-1663 7538
4296 -3194
2601 2859
-5683 -1847
-8165 -6790
3327 -4775
1472 9191
8474 -2609
-747 9269
-8084 4731
6262 8306
6640 -7468
2926 2454
19...

output:

2
1 2
1 3
1 4
1 5
1 8
1 9
1 13
1 14
1 17
1 18
1 19
1 20
1 27
1 28
1 33
1 37
1 39
1 42
1 47
1 49
1 50
1 53
1 55
1 64
1 66
1 70
1 72
1 79
1 80
1 81
1 87
1 88
1 91
1 93
1 95
1 98
1 102
1 106
1 107
1 110
1 112
1 120
1 122
1 126
1 127
1 130
1 134
1 138
1 143
1 149
1 151
1 152
1 155
1 158
1 160
1 162
1 16...

result:

ok 884 turns

Test #27:

score: 0
Accepted
time: 32ms
memory: 6360kb

input:

300
637 254
176 305
570 40
654 -786
755 949
371 256
739 638
-76 -596
631 4
644 -197
173 -238
-500 -390
741 -294
-775 -422
-892 580
672 -615
281 199
873 -10
655 -426
-810 -502
-20 -55
-3 -682
-127 -570
414 428
706 703
-854 -886
797 -295
746 -329
633 -911
-225 -36
-172 943
-983 -137
74 -640
-795 808
-...

output:

2
1 3
1 5
1 7
1 9
1 11
1 13
1 15
1 17
1 19
1 21
1 23
1 25
1 27
1 29
1 31
1 33
1 35
1 37
1 39
1 41
1 43
1 45
1 47
1 49
1 51
1 53
1 55
1 57
1 59
1 61
1 63
1 65
1 67
1 69
1 71
1 73
1 75
1 77
1 79
1 81
1 83
1 85
1 87
1 89
1 91
1 93
1 95
1 97
1 99
1 101
1 103
1 105
1 107
1 109
1 111
1 113
1 115
1 117
1 1...

result:

ok 880 turns

Test #28:

score: 0
Accepted
time: 33ms
memory: 6444kb

input:

300
-301 911
926 -107
-821 -480
-286 397
-120 184
414 673
-316 738
-469 234
262 -673
271 -558
915 600
-525 371
-988 -367
820 267
-291 883
279 665
-149 499
-187 -352
471 -700
-879 -147
976 270
-86 673
-26 209
499 -38
-723 370
-987 208
-339 511
128 -785
-36 -509
-493 -909
139 76
266 -926
743 -478
-482...

output:

1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 31
1 35
1 37
1 38
1 40
1 45
1 48
1 51
1 55
1 56
1 59
1 60
1 61
1 62
1 63
1 64
1 66
1 68
1 71
1 72
1 74
1 75
1 76
1 77
1 80
1 82
1 84
1 85
1 86
1 87
1 90
1 93
1 95
1 96
1 97
1 98
1 100
1 107
1 1...

result:

ok 885 turns

Test #29:

score: 0
Accepted
time: 32ms
memory: 6412kb

input:

300
-353 -433
-910 596
372 -113
-694 694
-110 -582
-428 -609
631 254
-331 -51
476 953
-102 -107
-41 -261
336 -870
399 675
-472 372
895 70
-1000 528
307 798
-132 495
59 -974
823 -906
783 -219
644 -860
889 101
355 -504
433 36
-233 -700
224 -684
625 -939
712 -107
354 -365
-966 -489
400 816
828 -390
-47...

output:

1
1 2
1 3
1 4
1 5
1 6
1 8
1 10
1 11
1 14
1 16
1 24
1 30
1 31
1 34
1 35
1 36
1 39
1 41
1 42
1 43
1 44
1 45
1 50
1 52
1 54
1 55
1 56
1 59
1 64
1 66
1 73
1 81
1 83
1 85
1 88
1 89
1 91
1 92
1 94
1 95
1 98
1 99
1 101
1 102
1 103
1 105
1 107
1 108
1 110
1 114
1 115
1 118
1 122
1 123
1 126
1 127
1 128
1 12...

result:

ok 881 turns

Test #30:

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

input:

10
100 0
81 59
31 95
-31 95
-81 59
-100 0
-81 -59
-31 -95
31 -95
81 -59
1 3
1 5
1 7
1 9
2 3
4 5
6 7
8 9
0 0

output:

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

result:

ok 17 turns

Test #31:

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

input:

10
100 0
81 59
31 95
-31 95
-81 59
-100 0
-81 -59
-31 -95
31 -95
81 -59
9 10
8 10
8 9
7 10
7 8
6 7
5 6
4 5
0 0

output:

1
1 2
1 3
1 4
1 5
1 6
1 7
1 10
2 3
3 4

result:

ok 17 turns

Test #32:

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

input:

10
100 0
81 59
31 95
-31 95
-81 59
-100 0
-81 -59
-31 -95
31 -95
81 -59
2 10
3 6
6 7
4 5
8 9
3 5
9 10
7 8
0 0

output:

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

result:

ok 17 turns

Test #33:

score: 0
Accepted
time: 4ms
memory: 3868kb

input:

100
1000 0
998 63
992 125
982 187
969 249
951 309
930 368
905 426
876 482
844 536
809 588
771 637
729 685
685 729
637 771
588 809
536 844
482 876
426 905
368 930
309 951
249 969
187 982
125 992
63 998
0 1000
-63 998
-125 992
-187 982
-249 969
-309 951
-368 930
-426 905
-482 876
-536 844
-588 809
-63...

output:

1
1 2
1 4
1 6
1 8
1 10
1 12
1 14
1 16
1 18
1 20
1 22
1 24
1 26
1 28
1 30
1 32
1 34
1 36
1 38
1 40
1 42
1 44
1 46
1 48
1 50
1 52
1 54
1 56
1 58
1 60
1 62
1 64
1 66
1 68
1 70
1 72
1 74
1 76
1 78
1 80
1 82
1 84
1 86
1 88
1 90
1 92
1 94
1 96
1 98
1 100
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 2...

result:

ok 197 turns

Test #34:

score: 0
Accepted
time: 5ms
memory: 3948kb

input:

100
1000 0
998 63
992 125
982 187
969 249
951 309
930 368
905 426
876 482
844 536
809 588
771 637
729 685
685 729
637 771
588 809
536 844
482 876
426 905
368 930
309 951
249 969
187 982
125 992
63 998
0 1000
-63 998
-125 992
-187 982
-249 969
-309 951
-368 930
-426 905
-482 876
-536 844
-588 809
-63...

output:

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

result:

ok 197 turns

Test #35:

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

input:

100
1000 0
998 63
992 125
982 187
969 249
951 309
930 368
905 426
876 482
844 536
809 588
771 637
729 685
685 729
637 771
588 809
536 844
482 876
426 905
368 930
309 951
249 969
187 982
125 992
63 998
0 1000
-63 998
-125 992
-187 982
-249 969
-309 951
-368 930
-426 905
-482 876
-536 844
-588 809
-63...

output:

1
1 2
1 3
1 4
1 5
1 80
1 81
1 82
1 83
1 84
1 85
1 86
1 87
1 88
1 89
1 90
1 91
1 92
1 93
1 95
1 96
1 97
1 98
1 99
1 100
2 3
3 4
4 5
5 6
5 11
5 13
5 15
5 42
5 78
5 79
6 7
6 8
6 9
6 10
7 8
9 10
10 11
12 13
13 14
14 15
15 16
15 17
15 38
15 41
16 17
17 18
17 27
18 19
20 21
20 24
20 25
21 22
22 23
23 24
2...

result:

ok 197 turns

Test #36:

score: 0
Accepted
time: 60ms
memory: 6316kb

input:

300
10000 0
9998 209
9991 419
9980 628
9965 837
9945 1045
9921 1253
9893 1461
9860 1668
9823 1874
9781 2079
9736 2284
9686 2487
9632 2689
9573 2890
9511 3090
9444 3289
9373 3486
9298 3681
9219 3875
9135 4067
9048 4258
8957 4446
8862 4633
8763 4818
8660 5000
8554 5180
8443 5358
8329 5534
8211 5707
80...

output:

1
1 2
1 4
1 6
1 8
1 10
1 12
1 14
1 16
1 18
1 20
1 22
1 24
1 26
1 28
1 30
1 32
1 34
1 36
1 38
1 40
1 42
1 44
1 46
1 48
1 50
1 52
1 54
1 56
1 58
1 60
1 62
1 64
1 66
1 68
1 70
1 72
1 74
1 76
1 78
1 80
1 82
1 84
1 86
1 88
1 90
1 92
1 94
1 96
1 98
1 100
1 102
1 104
1 106
1 108
1 110
1 112
1 114
1 116
1 1...

result:

ok 597 turns

Test #37:

score: 0
Accepted
time: 89ms
memory: 6440kb

input:

300
10000 0
9998 209
9991 419
9980 628
9965 837
9945 1045
9921 1253
9893 1461
9860 1668
9823 1874
9781 2079
9736 2284
9686 2487
9632 2689
9573 2890
9511 3090
9444 3289
9373 3486
9298 3681
9219 3875
9135 4067
9048 4258
8957 4446
8862 4633
8763 4818
8660 5000
8554 5180
8443 5358
8329 5534
8211 5707
80...

output:

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

result:

ok 597 turns

Test #38:

score: 0
Accepted
time: 25ms
memory: 6468kb

input:

300
10000 0
9998 209
9991 419
9980 628
9965 837
9945 1045
9921 1253
9893 1461
9860 1668
9823 1874
9781 2079
9736 2284
9686 2487
9632 2689
9573 2890
9511 3090
9444 3289
9373 3486
9298 3681
9219 3875
9135 4067
9048 4258
8957 4446
8862 4633
8763 4818
8660 5000
8554 5180
8443 5358
8329 5534
8211 5707
80...

output:

1
1 2
1 3
1 4
1 5
1 6
1 296
1 297
1 298
1 299
1 300
2 3
3 4
4 5
5 6
6 7
6 8
6 9
6 10
6 11
6 24
6 25
6 26
6 27
6 28
6 29
6 30
6 31
6 32
6 33
6 34
6 41
6 42
6 243
6 244
6 294
6 295
7 8
8 9
9 10
10 11
11 12
11 13
11 14
11 15
11 16
11 18
11 19
11 20
11 21
11 22
11 23
12 13
13 14
14 15
15 16
16 17
17 18
...

result:

ok 597 turns

Test #39:

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

input:

10
-100 -100
100 -100
0 100
30 -59
-29 -3
-2 -24
28 -58
31 -3
26 -6
15 -4
1 2
1 4
1 6
1 8
1 10
2 4
3 5
3 9
4 7
5 10
6 10
8 9
0 0

output:

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

result:

ok 24 turns

Test #40:

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

input:

10
-100 -100
100 -100
0 100
25 -17
-13 -81
30 -50
-21 -64
-3 -12
-6 -5
-5 -3
9 10
8 10
8 9
6 7
5 7
5 6
4 10
4 8
4 7
4 6
3 10
3 4
0 0

output:

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

result:

ok 24 turns

Test #41:

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

input:

10
-100 -100
100 -100
0 100
-14 -52
-22 -80
-31 -76
-4 -46
-28 -21
27 -26
-25 -45
2 10
3 6
2 4
7 10
6 10
4 5
2 9
5 6
3 10
7 9
4 10
6 8
0 0

output:

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

result:

ok 24 turns

Test #42:

score: 0
Accepted
time: 4ms
memory: 3860kb

input:

100
-1000 -1000
1000 -1000
0 1000
236 -661
142 -502
-329 -9
56 -28
100 -226
108 -577
-302 -867
282 -346
157 -258
66 -799
-37 -480
-322 -120
322 -394
-241 -545
96 -567
-24 -493
85 -658
-124 -517
-86 -57
-75 -610
-117 -657
-151 -678
27 -559
261 -520
-3 -174
-161 -358
-199 -461
-13 -634
157 -45
137 -54...

output:

2
1 3
1 5
1 7
1 9
1 11
1 13
1 15
1 17
1 19
1 21
1 23
1 25
1 27
1 29
1 31
1 33
1 35
1 37
1 39
1 41
1 43
1 45
1 47
1 49
1 51
1 53
1 55
1 57
1 59
1 61
1 63
1 65
1 67
1 69
1 71
1 73
1 75
1 77
1 79
1 81
1 83
1 85
1 87
1 89
1 91
1 93
1 95
1 97
1 99
2 3
2 13
2 50
2 58
2 78
2 83
2 86
2 88
3 7
3 22
3 43
3 56...

result:

ok 294 turns

Test #43:

score: 0
Accepted
time: 4ms
memory: 3816kb

input:

100
-1000 -1000
1000 -1000
0 1000
184 -957
5 -729
280 -394
315 -791
110 -807
151 -614
-23 -338
192 -677
6 -234
141 -661
39 -698
-128 -241
-73 -230
239 -270
-53 -331
31 -520
322 -193
150 -123
-269 -945
75 -284
-309 -930
-88 -641
129 -532
117 -518
-98 -476
144 -622
-220 -696
36 -760
155 -389
317 -131
...

output:

2
1 2
1 3
1 4
1 5
1 10
1 12
1 15
1 16
1 18
1 21
1 22
1 23
1 24
1 25
1 30
1 31
1 34
1 36
1 37
1 40
1 41
1 43
1 44
1 47
1 48
1 50
1 51
1 52
1 53
1 54
1 55
1 58
1 60
1 64
1 65
1 70
1 73
1 75
1 76
1 78
1 79
1 80
1 84
1 86
1 88
1 90
1 92
1 94
1 97
1 100
2 3
2 7
2 67
2 82
2 87
2 94
2 97
3 47
3 48
3 49
3 8...

result:

ok 294 turns

Test #44:

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

input:

100
-1000 -1000
1000 -1000
0 1000
132 -624
-277 -574
140 -779
42 -314
-98 -386
278 -263
256 -436
28 -15
220 -980
216 -524
-251 -535
-152 -744
-20 -678
-167 -3
28 -477
4 -538
-254 -347
204 -492
-15 -220
5 -571
-53 -813
48 -986
-290 -125
-247 -516
-276 -787
314 -885
-105 -303
314 -265
-212 -733
195 -3...

output:

2
1 2
1 3
1 5
1 6
1 9
1 11
1 12
1 14
1 15
1 17
1 20
1 22
1 24
1 25
1 26
1 27
1 28
1 30
1 32
1 35
1 38
1 39
1 40
1 42
1 45
1 47
1 49
1 53
1 54
1 56
1 57
1 60
1 62
1 65
1 66
1 69
1 70
1 74
1 76
1 77
1 78
1 82
1 86
1 87
1 90
1 91
1 94
1 95
1 97
1 98
1 99
2 12
2 25
2 40
2 43
2 55
2 56
2 74
2 94
3 11
3 1...

result:

ok 294 turns

Test #45:

score: 0
Accepted
time: 37ms
memory: 6356kb

input:

300
-10000 -10000
10000 -10000
0 10000
1778 -6214
167 -5663
209 -9106
-2750 -8501
-320 -7951
1033 -8680
1122 -6347
975 -1892
216 -9531
54 -7869
-3234 -8289
2798 -3925
-2367 -9897
3072 -1352
1088 -4192
-2058 -5996
710 -9518
3044 -3902
-879 -7617
-1278 -9152
1893 -9292
-3208 -8479
1061 -8975
-437 -952...

output:

2
1 3
1 5
1 7
1 9
1 11
1 13
1 15
1 17
1 19
1 21
1 23
1 25
1 27
1 29
1 31
1 33
1 35
1 37
1 39
1 41
1 43
1 45
1 47
1 49
1 51
1 53
1 55
1 57
1 59
1 61
1 63
1 65
1 67
1 69
1 71
1 73
1 75
1 77
1 79
1 81
1 83
1 85
1 87
1 89
1 91
1 93
1 95
1 97
1 99
1 101
1 103
1 105
1 107
1 109
1 111
1 113
1 115
1 117
1 1...

result:

ok 894 turns

Test #46:

score: 0
Accepted
time: 31ms
memory: 6616kb

input:

300
-10000 -10000
10000 -10000
0 10000
-2306 -3305
2514 -691
1043 -9556
434 -4390
2123 -9066
-1050 -9083
1368 -5388
1332 -8952
2584 -7749
2352 -9708
-2256 -7865
1947 -8788
120 -6147
-158 -9051
-2193 -7224
2935 -9523
-2421 -3282
2401 -6685
2533 -3415
-2309 -8816
2425 -9392
2633 -5745
157 -4265
-539 -...

output:

2
1 2
1 3
1 4
1 5
1 6
1 9
1 13
1 14
1 18
1 19
1 20
1 23
1 24
1 28
1 29
1 30
1 35
1 36
1 37
1 38
1 40
1 42
1 43
1 44
1 45
1 46
1 47
1 49
1 52
1 53
1 55
1 61
1 63
1 69
1 72
1 76
1 78
1 80
1 81
1 83
1 87
1 88
1 91
1 92
1 95
1 97
1 99
1 100
1 101
1 102
1 105
1 108
1 112
1 114
1 115
1 119
1 120
1 122
1 1...

result:

ok 894 turns

Test #47:

score: 0
Accepted
time: 36ms
memory: 6420kb

input:

300
-10000 -10000
10000 -10000
0 10000
1828 -802
2006 -9628
-980 -412
2132 -2437
-2100 -2339
-2358 -7327
2388 -6181
-1347 -5604
2095 -6374
-468 -7638
3129 -7034
-1939 -5808
1832 -2398
3278 -2841
-1663 -8099
-2371 -1299
2601 -4889
984 -9468
-1498 -4898
3327 -8072
1472 -5582
1807 -853
-747 -5648
-1417...

output:

2
1 2
1 3
1 5
1 8
1 9
1 11
1 15
1 18
1 22
1 27
1 35
1 42
1 43
1 44
1 52
1 60
1 61
1 68
1 69
1 83
1 84
1 85
1 86
1 88
1 89
1 91
1 95
1 98
1 101
1 109
1 113
1 116
1 117
1 118
1 123
1 126
1 129
1 138
1 143
1 146
1 147
1 148
1 150
1 155
1 157
1 167
1 168
1 170
1 171
1 177
1 178
1 179
1 180
1 191
1 197
1...

result:

ok 894 turns