QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#290520#1148. GameMoRanSky100 ✓164ms16024kbC++231.4kb2023-12-25 05:16:462023-12-25 05:16:47

Judging History

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

  • [2023-12-25 05:16:47]
  • 评测
  • 测评结果:100
  • 用时:164ms
  • 内存:16024kb
  • [2023-12-25 05:16:46]
  • 提交

answer

// Skyqwq
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

typedef long long LL;
typedef pair<int, int> PII;


template <typename T> bool inline chkMin(T &x, T y) { return y < x ? x = y, 1 : 0; }
template <typename T> bool inline chkMax(T &x, T y) { return y > x ? x = y, 1 : 0; }

#include "game.h"

const int N = 1505;

int f[N], n, g[N][N], t, w[N][N], sz[N];

PII e[N * N];

int find(int x) {
    return x == f[x] ? x : f[x] = find(f[x]);
}

bool merge(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return 0;
    f[x] = y; sz[y] += sz[x];
    for (int i = 1; i <= n; i++) {
        w[y][i] += w[x][i];
    }
    for (int i = 1; i <= n; i++) {
        if (find(i) == i && i != x && i != y) {
            w[i][y] += w[i][x];
        }
    }
    return 1;
}

void initialize(int nt) {
    n = nt; t = 0;
    for (int i = 1; i <= n; i++) f[i] = i, sz[i] = 1;
}

void inline apd(int x, int y) {
    x = find(x);
    if (find(y) != x)
        w[x][find(y)]++;
}

bool inline chk(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return 0;
    int ct = w[x][y];
    return ct + 1 == sz[x] * sz[y];
}

int hasEdge(int u, int v) {
    ++u, ++v;
    if (chk(u, v)) {
        merge(u, v);
        return 1;
    } else {
        apd(u, v), apd(v, u);
        return 0;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 1ms
memory: 7684kb

input:

4
0 1
3 0
1 2
0 2
3 1
2 3

output:

1
0
0
1
0
1

result:

ok correct

Test #2:

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

input:

4
0 3
2 0
0 1
1 2
1 3
2 3

output:

1
0
0
1
0
1

result:

ok correct

Test #3:

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

input:

4
0 3
1 0
0 2
3 1
1 2
2 3

output:

1
0
0
1
0
1

result:

ok correct

Test #4:

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

input:

4
3 1
1 2
0 2
0 3
1 0
3 2

output:

1
0
1
0
0
1

result:

ok correct

Test #5:

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

input:

4
1 2
2 3
2 0
1 0
3 1
0 3

output:

1
0
0
1
0
1

result:

ok correct

Test #6:

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

input:

4
2 0
0 3
1 2
1 0
3 1
3 2

output:

1
0
0
1
0
1

result:

ok correct

Test #7:

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

input:

4
3 0
0 1
1 3
0 2
2 3
1 2

output:

1
0
1
0
0
1

result:

ok correct

Test #8:

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

input:

4
1 0
0 2
2 3
2 1
3 1
0 3

output:

1
0
1
0
0
1

result:

ok correct

Test #9:

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

input:

4
0 2
2 3
1 3
2 1
3 0
1 0

output:

1
0
1
0
0
1

result:

ok correct

Test #10:

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

input:

4
3 0
2 0
2 1
3 1
1 0
3 2

output:

1
0
1
0
0
1

result:

ok correct

Test #11:

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

input:

4
1 2
1 3
0 2
1 0
2 3
3 0

output:

1
0
0
1
0
1

result:

ok correct

Test #12:

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

input:

4
0 3
2 1
2 3
0 2
1 3
1 0

output:

1
1
0
0
0
1

result:

ok correct

Test #13:

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

input:

4
1 0
0 2
0 3
1 2
3 1
3 2

output:

1
0
0
1
0
1

result:

ok correct

Test #14:

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

input:

4
2 3
1 3
2 1
3 0
2 0
0 1

output:

1
0
1
0
0
1

result:

ok correct

Test #15:

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

input:

4
1 0
3 0
0 2
3 1
2 3
2 1

output:

1
0
0
1
0
1

result:

ok correct

Test #16:

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

input:

4
0 1
2 1
3 1
3 0
3 2
0 2

output:

1
0
0
1
0
1

result:

ok correct

Test #17:

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

input:

4
1 2
3 1
0 3
0 2
1 0
2 3

output:

1
0
1
0
0
1

result:

ok correct

Test #18:

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

input:

4
2 0
1 2
2 3
0 3
1 3
0 1

output:

1
0
0
1
0
1

result:

ok correct

Test #19:

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

input:

4
2 1
0 3
1 0
2 3
3 1
2 0

output:

1
1
0
0
0
1

result:

ok correct

Test #20:

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

input:

4
1 2
2 3
3 1
0 1
3 0
2 0

output:

1
0
1
0
0
1

result:

ok correct

Test #21:

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

input:

4
2 0
1 3
1 0
1 2
3 2
0 3

output:

1
1
0
0
0
1

result:

ok correct

Test #22:

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

input:

4
1 2
3 2
3 1
0 1
0 2
3 0

output:

1
0
1
0
0
1

result:

ok correct

Test #23:

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

input:

4
0 2
1 2
0 1
0 3
2 3
1 3

output:

1
0
1
0
0
1

result:

ok correct

Test #24:

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

input:

4
1 0
2 3
1 3
2 0
0 3
2 1

output:

1
1
0
0
0
1

result:

ok correct

Subtask #2:

score: 27
Accepted

Test #25:

score: 27
Accepted
time: 1ms
memory: 7824kb

input:

4
0 1
3 0
1 2
0 2
3 1
2 3

output:

1
0
0
1
0
1

result:

ok correct

Test #26:

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

input:

4
0 3
2 0
0 1
1 2
1 3
2 3

output:

1
0
0
1
0
1

result:

ok correct

Test #27:

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

input:

4
0 3
1 0
0 2
3 1
1 2
2 3

output:

1
0
0
1
0
1

result:

ok correct

Test #28:

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

input:

4
3 1
1 2
0 2
0 3
1 0
3 2

output:

1
0
1
0
0
1

result:

ok correct

Test #29:

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

input:

4
1 2
2 3
2 0
1 0
3 1
0 3

output:

1
0
0
1
0
1

result:

ok correct

Test #30:

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

input:

4
2 0
0 3
1 2
1 0
3 1
3 2

output:

1
0
0
1
0
1

result:

ok correct

Test #31:

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

input:

4
3 0
0 1
1 3
0 2
2 3
1 2

output:

1
0
1
0
0
1

result:

ok correct

Test #32:

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

input:

4
1 0
0 2
2 3
2 1
3 1
0 3

output:

1
0
1
0
0
1

result:

ok correct

Test #33:

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

input:

4
0 2
2 3
1 3
2 1
3 0
1 0

output:

1
0
1
0
0
1

result:

ok correct

Test #34:

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

input:

4
3 0
2 0
2 1
3 1
1 0
3 2

output:

1
0
1
0
0
1

result:

ok correct

Test #35:

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

input:

4
1 2
1 3
0 2
1 0
2 3
3 0

output:

1
0
0
1
0
1

result:

ok correct

Test #36:

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

input:

4
0 3
2 1
2 3
0 2
1 3
1 0

output:

1
1
0
0
0
1

result:

ok correct

Test #37:

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

input:

4
1 0
0 2
0 3
1 2
3 1
3 2

output:

1
0
0
1
0
1

result:

ok correct

Test #38:

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

input:

4
2 3
1 3
2 1
3 0
2 0
0 1

output:

1
0
1
0
0
1

result:

ok correct

Test #39:

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

input:

4
1 0
3 0
0 2
3 1
2 3
2 1

output:

1
0
0
1
0
1

result:

ok correct

Test #40:

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

input:

4
0 1
2 1
3 1
3 0
3 2
0 2

output:

1
0
0
1
0
1

result:

ok correct

Test #41:

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

input:

4
1 2
3 1
0 3
0 2
1 0
2 3

output:

1
0
1
0
0
1

result:

ok correct

Test #42:

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

input:

4
2 0
1 2
2 3
0 3
1 3
0 1

output:

1
0
0
1
0
1

result:

ok correct

Test #43:

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

input:

4
2 1
0 3
1 0
2 3
3 1
2 0

output:

1
1
0
0
0
1

result:

ok correct

Test #44:

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

input:

4
1 2
2 3
3 1
0 1
3 0
2 0

output:

1
0
1
0
0
1

result:

ok correct

Test #45:

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

input:

4
2 0
1 3
1 0
1 2
3 2
0 3

output:

1
1
0
0
0
1

result:

ok correct

Test #46:

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

input:

4
1 2
3 2
3 1
0 1
0 2
3 0

output:

1
0
1
0
0
1

result:

ok correct

Test #47:

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

input:

4
0 2
1 2
0 1
0 3
2 3
1 3

output:

1
0
1
0
0
1

result:

ok correct

Test #48:

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

input:

4
1 0
2 3
1 3
2 0
0 3
2 1

output:

1
1
0
0
0
1

result:

ok correct

Test #49:

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

input:

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

output:

1
1
1
1
1
0
0
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #50:

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

input:

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

output:

1
1
1
1
1
1
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #51:

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

input:

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

output:

1
0
1
1
1
0
0
1
1
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #52:

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

input:

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

output:

1
1
1
0
1
1
1
1
0
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #53:

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

input:

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

output:

1
1
1
0
1
1
1
0
0
0
1
0
1
0
0
0
1
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #54:

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

input:

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

output:

1
1
0
1
0
0
1
1
1
0
0
1
0
0
1
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #55:

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

input:

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

output:

1
0
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #56:

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

input:

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

output:

1
1
0
1
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #57:

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

input:

33
31 0
31 23
31 18
14 17
22 4
19 9
6 13
13 23
12 27
23 9
31 7
24 25
1 0
9 14
24 10
23 1
26 29
16 6
30 31
16 20
20 10
1 17
22 24
30 1
32 10
25 16
31 25
12 32
29 30
31 5
2 31
12 14
16 3
0 27
29 28
16 10
11 29
30 23
6 14
32 19
6 20
16 5
1 2
10 13
14 19
32 11
20 5
5 7
1 12
0 15
12 6
9 30
30 17
16 32
9 ...

output:

1
0
0
1
1
1
1
0
1
0
0
1
0
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #58:

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

input:

80
77 16
16 63
9 36
68 73
61 40
16 6
9 41
53 62
10 2
50 40
24 17
14 29
56 4
24 54
26 33
75 30
47 20
67 16
48 8
60 64
23 35
51 53
5 41
38 58
58 16
30 78
73 75
38 25
36 13
62 74
48 78
12 43
7 19
78 36
78 70
37 1
44 8
19 18
78 64
50 3
67 0
77 8
73 76
24 29
28 78
77 72
1 29
64 10
24 30
40 3
17 79
18 61
...

output:

1
0
1
1
1
0
0
1
1
0
1
1
1
0
1
1
1
0
1
1
1
0
1
1
0
0
0
0
0
0
0
1
1
0
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #59:

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

input:

80
24 7
17 55
38 10
45 34
35 11
1 0
33 5
57 78
33 30
65 59
14 79
2 79
54 7
35 79
30 10
76 11
77 79
73 16
24 61
73 36
59 73
30 79
72 5
52 23
46 58
3 42
44 17
29 41
24 40
74 48
38 58
69 23
53 70
43 27
47 75
63 14
55 18
19 77
27 72
61 75
0 26
32 75
47 25
74 77
15 50
20 56
5 37
11 58
11 26
15 18
74 57
6...

output:

1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
1
1
1
0
1
0
1
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #60:

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

input:

80
13 20
13 45
60 44
66 15
69 25
25 15
48 11
47 27
57 0
53 47
70 35
54 38
27 21
27 58
39 23
35 32
45 29
43 75
37 15
67 8
69 63
25 71
18 24
50 66
28 13
16 29
10 78
26 38
50 11
0 54
67 44
28 25
61 62
43 54
22 38
31 27
31 24
5 7
53 61
21 11
78 6
0 73
79 14
63 39
52 58
25 20
16 25
46 59
30 47
24 11
33 5...

output:

1
0
1
1
1
0
1
1
1
0
1
1
0
0
1
0
1
1
0
1
0
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
...

result:

ok correct

Test #61:

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

input:

80
13 33
50 68
36 7
44 10
41 44
62 1
64 16
8 77
76 39
58 70
62 72
57 16
63 45
36 64
17 47
50 11
72 36
39 45
66 14
65 78
62 66
22 14
45 7
30 3
79 25
25 27
53 13
10 19
74 12
50 33
52 11
14 52
2 57
27 63
9 75
11 8
37 68
23 64
52 34
50 59
44 53
34 55
78 53
46 70
32 71
7 14
0 76
54 21
28 5
9 1
56 49
55 3...

output:

1
1
1
1
0
1
1
1
1
1
0
0
1
0
1
0
0
0
1
1
0
0
0
1
1
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
1
0
0
1
0
0
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
...

result:

ok correct

Test #62:

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

input:

80
39 45
57 14
48 65
61 77
35 3
16 54
71 25
47 16
36 50
22 29
54 70
60 74
26 46
37 5
53 0
64 19
24 45
8 74
3 1
62 5
39 6
58 79
30 16
36 77
27 28
55 32
71 3
59 64
61 38
15 41
12 66
51 46
66 27
29 76
69 72
9 23
50 75
56 71
20 61
77 12
29 4
31 43
0 50
64 62
54 34
39 2
12 78
79 25
19 0
21 38
2 12
63 5
7...

output:

1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
0
0
1
0
0
1
1
0
0
0
1
1
0
0
0
1
1
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
...

result:

ok correct

Test #63:

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

input:

80
71 0
46 57
0 28
60 48
67 55
26 66
41 66
24 18
57 62
72 19
34 7
21 69
7 14
67 51
27 79
17 58
31 34
36 2
29 18
3 74
43 23
34 71
67 37
49 42
46 50
33 2
0 64
75 72
65 18
23 56
66 49
33 42
21 49
49 5
12 66
13 6
52 54
75 44
71 47
45 76
16 38
73 35
63 18
16 52
15 76
71 6
60 27
37 47
2 4
1 41
54 42
15 39...

output:

1
1
0
1
1
1
0
1
0
1
1
1
0
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #64:

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

input:

80
71 21
46 38
22 40
47 64
1 71
5 62
53 15
71 53
52 28
32 16
14 4
73 27
0 57
43 63
60 15
54 44
0 68
72 19
79 65
65 26
52 30
45 26
71 50
69 13
67 26
57 37
79 53
61 17
79 78
6 74
66 2
11 72
11 70
61 41
6 27
30 62
35 15
69 59
68 32
44 2
27 17
71 7
52 64
11 76
18 35
32 48
66 31
44 48
58 47
78 33
15 8
4 ...

output:

1
1
1
1
0
1
1
0
1
1
1
1
1
1
0
1
0
1
1
0
0
1
0
1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
...

result:

ok correct

Test #65:

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

input:

80
19 72
39 26
33 59
14 4
22 54
0 72
45 15
44 61
50 23
38 40
5 53
23 10
77 54
3 20
78 15
64 9
42 11
16 64
37 66
21 17
76 15
23 18
12 54
74 29
21 20
10 29
77 24
25 44
79 55
76 71
1 37
26 1
40 16
33 44
42 21
49 15
40 61
20 11
60 61
0 23
77 32
70 34
39 44
55 26
6 28
42 25
13 23
18 32
49 50
44 54
6 46
1...

output:

1
1
1
1
1
0
1
1
1
1
1
0
0
1
0
1
1
0
1
1
0
0
0
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #66:

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

input:

80
54 59
47 66
0 75
23 0
33 17
13 68
29 38
31 6
9 59
71 78
54 51
22 6
60 69
58 24
50 72
19 77
12 64
11 22
54 55
47 5
33 52
51 24
37 42
26 8
65 49
66 12
46 31
47 50
26 68
51 50
71 37
59 20
47 36
52 58
42 50
61 7
65 16
33 75
17 18
71 45
57 7
42 73
44 3
49 14
12 72
78 61
0 36
58 55
14 59
75 26
10 62
40...

output:

1
1
1
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #67:

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

input:

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

output:

1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #68:

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

input:

80
79 78
77 79
78 77
79 76
78 76
77 76
79 75
75 78
77 75
76 75
74 79
74 78
77 74
74 76
75 74
79 73
73 78
77 73
73 76
75 73
73 74
72 79
78 72
77 72
72 76
72 75
74 72
72 73
71 79
78 71
71 77
76 71
71 75
74 71
71 73
72 71
79 70
70 78
70 77
70 76
70 75
70 74
73 70
70 72
70 71
69 79
69 78
69 77
69 76
69 ...

output:

1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #69:

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

input:

80
59 52
23 59
37 31
7 72
69 54
23 27
37 46
61 57
9 23
59 31
59 73
6 54
42 17
0 3
52 58
67 39
21 72
59 30
73 35
37 75
78 31
75 77
24 3
34 19
59 14
10 3
42 33
72 48
49 44
70 60
21 17
1 47
33 22
34 29
29 70
1 8
35 66
63 29
22 10
15 26
60 4
36 52
48 53
2 49
45 11
14 72
64 5
1 40
45 19
15 7
63 26
42 65
...

output:

1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
1
0
0
1
0
0
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #70:

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

input:

80
29 59
7 20
36 43
27 1
39 6
51 50
11 53
15 69
25 22
54 44
54 28
64 23
51 66
11 55
65 37
2 57
76 45
73 45
5 11
34 75
28 41
54 19
31 73
70 32
45 55
43 68
76 29
5 52
12 56
18 70
14 15
50 5
77 11
54 25
20 26
70 68
59 56
76 19
29 26
41 79
12 8
49 39
15 1
38 14
14 46
72 70
59 50
46 13
44 67
65 36
45 33
...

output:

1
1
1
1
1
1
1
1
1
1
0
1
0
0
1
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
...

result:

ok correct

Test #71:

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

input:

80
74 35
75 43
6 17
21 64
17 52
70 31
63 3
57 42
67 31
48 9
37 44
79 72
54 53
32 58
9 13
59 54
58 51
38 10
52 44
79 64
45 52
41 39
59 73
36 20
72 33
42 66
69 55
8 79
15 27
1 3
22 37
38 23
52 16
60 40
69 28
16 67
58 72
39 12
50 13
50 62
69 32
77 37
45 37
51 62
31 20
42 75
35 11
0 68
49 16
53 37
67 33...

output:

1
1
1
1
0
1
1
1
0
1
1
1
1
1
0
0
0
1
0
0
1
1
1
1
0
0
1
0
1
0
0
0
0
1
0
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #72:

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

input:

80
26 54
22 24
26 9
7 34
39 57
46 32
8 21
9 40
57 56
27 11
69 22
15 64
7 68
4 35
57 11
2 0
32 40
24 31
37 52
36 38
48 6
29 71
50 32
52 49
79 31
53 68
78 56
22 43
55 75
53 20
64 32
22 48
66 77
31 17
11 58
11 69
35 14
18 79
67 55
19 44
61 10
33 74
63 0
70 29
1 77
22 4
10 3
47 68
55 41
59 4
44 28
18 62...

output:

1
1
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
0
0
0
1
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #73:

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

input:

80
61 51
46 16
29 43
67 77
25 53
62 46
77 58
25 71
69 22
68 65
70 61
0 65
14 9
9 37
52 30
19 17
70 53
76 68
76 9
23 71
43 64
77 7
10 77
4 42
40 55
28 10
14 16
4 32
1 49
14 79
23 24
69 2
57 31
7 2
38 54
76 33
20 74
53 11
68 57
50 64
42 47
61 40
24 58
31 69
35 46
7 31
11 50
7 47
22 26
15 64
9 36
76 78...

output:

1
1
1
1
1
0
0
0
1
1
0
0
1
0
1
1
0
0
0
1
0
0
0
1
1
1
0
0
1
0
0
0
1
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #74:

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

input:

80
10 34
47 33
72 68
8 27
63 62
59 8
74 8
47 36
37 24
53 49
34 77
41 49
54 18
4 5
12 65
27 77
68 15
53 78
28 70
74 36
65 55
12 78
57 33
36 65
54 27
5 39
63 45
78 62
28 33
77 36
4 54
40 57
34 63
65 47
55 37
34 17
70 17
27 74
24 39
9 47
27 0
12 72
77 45
65 28
12 45
38 10
34 4
77 37
53 8
45 36
74 39
27...

output:

1
1
1
1
1
0
0
0
1
1
0
0
1
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #75:

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

input:

80
15 35
37 41
35 8
14 67
55 66
36 66
57 40
15 59
14 30
40 23
58 43
43 18
54 18
59 77
15 3
79 23
49 37
66 16
37 58
57 30
30 66
19 40
55 63
27 6
41 49
15 51
27 54
3 54
15 63
63 49
8 33
63 19
51 66
8 15
49 56
45 8
23 30
23 57
48 35
49 54
49 10
33 57
16 19
19 48
8 27
63 3
66 46
71 18
36 30
51 8
33 59
2...

output:

1
1
0
1
1
0
1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
...

result:

ok correct

Test #76:

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

input:

80
40 75
40 39
35 16
26 78
25 34
26 15
21 25
17 53
47 38
68 33
15 40
31 74
33 56
56 65
29 34
74 52
59 74
36 53
70 0
58 25
33 39
57 56
41 4
68 22
16 17
39 53
47 30
64 31
17 8
64 57
47 57
27 19
41 38
27 51
68 51
38 57
57 27
33 27
23 78
70 23
30 35
69 64
65 68
30 37
68 48
56 58
70 69
0 78
22 21
36 35
3...

output:

1
0
1
1
1
0
0
1
1
1
0
1
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
...

result:

ok correct

Test #77:

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

input:

80
66 60
74 16
7 43
11 60
55 75
78 61
78 11
6 75
77 73
36 41
11 44
16 40
15 27
2 64
75 74
36 78
74 46
41 46
44 23
75 79
45 75
13 27
5 62
64 60
55 16
7 36
6 27
44 32
43 5
8 41
2 6
5 36
73 45
40 2
60 27
15 13
75 8
44 64
40 46
44 79
11 62
41 15
11 30
2 27
32 73
11 36
7 77
6 32
43 77
8 30
2 45
23 64
5 3...

output:

1
1
1
0
1
1
0
0
1
1
1
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #78:

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

input:

80
26 38
71 47
15 52
70 44
72 66
25 23
31 9
44 71
6 79
59 49
6 38
71 38
71 25
25 52
73 60
26 44
25 26
57 15
26 2
57 59
73 5
5 72
70 77
54 26
49 57
71 57
5 41
2 6
27 6
31 63
60 3
25 45
41 27
32 59
23 52
79 9
77 38
41 14
26 72
2 52
56 15
23 27
72 9
70 32
32 73
6 25
14 77
27 70
25 54
77 30
2 45
60 6
70...

output:

1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Subtask #3:

score: 58
Accepted

Test #79:

score: 58
Accepted
time: 1ms
memory: 7740kb

input:

4
0 1
3 0
1 2
0 2
3 1
2 3

output:

1
0
0
1
0
1

result:

ok correct

Test #80:

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

input:

4
0 3
2 0
0 1
1 2
1 3
2 3

output:

1
0
0
1
0
1

result:

ok correct

Test #81:

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

input:

4
0 3
1 0
0 2
3 1
1 2
2 3

output:

1
0
0
1
0
1

result:

ok correct

Test #82:

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

input:

4
3 1
1 2
0 2
0 3
1 0
3 2

output:

1
0
1
0
0
1

result:

ok correct

Test #83:

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

input:

4
1 2
2 3
2 0
1 0
3 1
0 3

output:

1
0
0
1
0
1

result:

ok correct

Test #84:

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

input:

4
2 0
0 3
1 2
1 0
3 1
3 2

output:

1
0
0
1
0
1

result:

ok correct

Test #85:

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

input:

4
3 0
0 1
1 3
0 2
2 3
1 2

output:

1
0
1
0
0
1

result:

ok correct

Test #86:

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

input:

4
1 0
0 2
2 3
2 1
3 1
0 3

output:

1
0
1
0
0
1

result:

ok correct

Test #87:

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

input:

4
0 2
2 3
1 3
2 1
3 0
1 0

output:

1
0
1
0
0
1

result:

ok correct

Test #88:

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

input:

4
3 0
2 0
2 1
3 1
1 0
3 2

output:

1
0
1
0
0
1

result:

ok correct

Test #89:

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

input:

4
1 2
1 3
0 2
1 0
2 3
3 0

output:

1
0
0
1
0
1

result:

ok correct

Test #90:

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

input:

4
0 3
2 1
2 3
0 2
1 3
1 0

output:

1
1
0
0
0
1

result:

ok correct

Test #91:

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

input:

4
1 0
0 2
0 3
1 2
3 1
3 2

output:

1
0
0
1
0
1

result:

ok correct

Test #92:

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

input:

4
2 3
1 3
2 1
3 0
2 0
0 1

output:

1
0
1
0
0
1

result:

ok correct

Test #93:

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

input:

4
1 0
3 0
0 2
3 1
2 3
2 1

output:

1
0
0
1
0
1

result:

ok correct

Test #94:

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

input:

4
0 1
2 1
3 1
3 0
3 2
0 2

output:

1
0
0
1
0
1

result:

ok correct

Test #95:

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

input:

4
1 2
3 1
0 3
0 2
1 0
2 3

output:

1
0
1
0
0
1

result:

ok correct

Test #96:

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

input:

4
2 0
1 2
2 3
0 3
1 3
0 1

output:

1
0
0
1
0
1

result:

ok correct

Test #97:

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

input:

4
2 1
0 3
1 0
2 3
3 1
2 0

output:

1
1
0
0
0
1

result:

ok correct

Test #98:

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

input:

4
1 2
2 3
3 1
0 1
3 0
2 0

output:

1
0
1
0
0
1

result:

ok correct

Test #99:

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

input:

4
2 0
1 3
1 0
1 2
3 2
0 3

output:

1
1
0
0
0
1

result:

ok correct

Test #100:

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

input:

4
1 2
3 2
3 1
0 1
0 2
3 0

output:

1
0
1
0
0
1

result:

ok correct

Test #101:

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

input:

4
0 2
1 2
0 1
0 3
2 3
1 3

output:

1
0
1
0
0
1

result:

ok correct

Test #102:

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

input:

4
1 0
2 3
1 3
2 0
0 3
2 1

output:

1
1
0
0
0
1

result:

ok correct

Test #103:

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

input:

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

output:

1
1
1
1
1
0
0
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #104:

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

input:

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

output:

1
1
1
1
1
1
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #105:

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

input:

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

output:

1
0
1
1
1
0
0
1
1
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #106:

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

input:

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

output:

1
1
1
0
1
1
1
1
0
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #107:

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

input:

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

output:

1
1
1
0
1
1
1
0
0
0
1
0
1
0
0
0
1
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #108:

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

input:

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

output:

1
1
0
1
0
0
1
1
1
0
0
1
0
0
1
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #109:

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

input:

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

output:

1
0
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #110:

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

input:

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

output:

1
1
0
1
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #111:

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

input:

33
31 0
31 23
31 18
14 17
22 4
19 9
6 13
13 23
12 27
23 9
31 7
24 25
1 0
9 14
24 10
23 1
26 29
16 6
30 31
16 20
20 10
1 17
22 24
30 1
32 10
25 16
31 25
12 32
29 30
31 5
2 31
12 14
16 3
0 27
29 28
16 10
11 29
30 23
6 14
32 19
6 20
16 5
1 2
10 13
14 19
32 11
20 5
5 7
1 12
0 15
12 6
9 30
30 17
16 32
9 ...

output:

1
0
0
1
1
1
1
0
1
0
0
1
0
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #112:

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

input:

80
77 16
16 63
9 36
68 73
61 40
16 6
9 41
53 62
10 2
50 40
24 17
14 29
56 4
24 54
26 33
75 30
47 20
67 16
48 8
60 64
23 35
51 53
5 41
38 58
58 16
30 78
73 75
38 25
36 13
62 74
48 78
12 43
7 19
78 36
78 70
37 1
44 8
19 18
78 64
50 3
67 0
77 8
73 76
24 29
28 78
77 72
1 29
64 10
24 30
40 3
17 79
18 61
...

output:

1
0
1
1
1
0
0
1
1
0
1
1
1
0
1
1
1
0
1
1
1
0
1
1
0
0
0
0
0
0
0
1
1
0
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #113:

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

input:

80
24 7
17 55
38 10
45 34
35 11
1 0
33 5
57 78
33 30
65 59
14 79
2 79
54 7
35 79
30 10
76 11
77 79
73 16
24 61
73 36
59 73
30 79
72 5
52 23
46 58
3 42
44 17
29 41
24 40
74 48
38 58
69 23
53 70
43 27
47 75
63 14
55 18
19 77
27 72
61 75
0 26
32 75
47 25
74 77
15 50
20 56
5 37
11 58
11 26
15 18
74 57
6...

output:

1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
1
1
1
0
1
0
1
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #114:

score: 0
Accepted
time: 2ms
memory: 8116kb

input:

80
13 20
13 45
60 44
66 15
69 25
25 15
48 11
47 27
57 0
53 47
70 35
54 38
27 21
27 58
39 23
35 32
45 29
43 75
37 15
67 8
69 63
25 71
18 24
50 66
28 13
16 29
10 78
26 38
50 11
0 54
67 44
28 25
61 62
43 54
22 38
31 27
31 24
5 7
53 61
21 11
78 6
0 73
79 14
63 39
52 58
25 20
16 25
46 59
30 47
24 11
33 5...

output:

1
0
1
1
1
0
1
1
1
0
1
1
0
0
1
0
1
1
0
1
0
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
...

result:

ok correct

Test #115:

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

input:

80
13 33
50 68
36 7
44 10
41 44
62 1
64 16
8 77
76 39
58 70
62 72
57 16
63 45
36 64
17 47
50 11
72 36
39 45
66 14
65 78
62 66
22 14
45 7
30 3
79 25
25 27
53 13
10 19
74 12
50 33
52 11
14 52
2 57
27 63
9 75
11 8
37 68
23 64
52 34
50 59
44 53
34 55
78 53
46 70
32 71
7 14
0 76
54 21
28 5
9 1
56 49
55 3...

output:

1
1
1
1
0
1
1
1
1
1
0
0
1
0
1
0
0
0
1
1
0
0
0
1
1
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
1
0
0
1
0
0
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
...

result:

ok correct

Test #116:

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

input:

80
39 45
57 14
48 65
61 77
35 3
16 54
71 25
47 16
36 50
22 29
54 70
60 74
26 46
37 5
53 0
64 19
24 45
8 74
3 1
62 5
39 6
58 79
30 16
36 77
27 28
55 32
71 3
59 64
61 38
15 41
12 66
51 46
66 27
29 76
69 72
9 23
50 75
56 71
20 61
77 12
29 4
31 43
0 50
64 62
54 34
39 2
12 78
79 25
19 0
21 38
2 12
63 5
7...

output:

1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
0
0
1
0
0
1
1
0
0
0
1
1
0
0
0
1
1
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
...

result:

ok correct

Test #117:

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

input:

80
71 0
46 57
0 28
60 48
67 55
26 66
41 66
24 18
57 62
72 19
34 7
21 69
7 14
67 51
27 79
17 58
31 34
36 2
29 18
3 74
43 23
34 71
67 37
49 42
46 50
33 2
0 64
75 72
65 18
23 56
66 49
33 42
21 49
49 5
12 66
13 6
52 54
75 44
71 47
45 76
16 38
73 35
63 18
16 52
15 76
71 6
60 27
37 47
2 4
1 41
54 42
15 39...

output:

1
1
0
1
1
1
0
1
0
1
1
1
0
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #118:

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

input:

80
71 21
46 38
22 40
47 64
1 71
5 62
53 15
71 53
52 28
32 16
14 4
73 27
0 57
43 63
60 15
54 44
0 68
72 19
79 65
65 26
52 30
45 26
71 50
69 13
67 26
57 37
79 53
61 17
79 78
6 74
66 2
11 72
11 70
61 41
6 27
30 62
35 15
69 59
68 32
44 2
27 17
71 7
52 64
11 76
18 35
32 48
66 31
44 48
58 47
78 33
15 8
4 ...

output:

1
1
1
1
0
1
1
0
1
1
1
1
1
1
0
1
0
1
1
0
0
1
0
1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
...

result:

ok correct

Test #119:

score: 0
Accepted
time: 2ms
memory: 7760kb

input:

80
19 72
39 26
33 59
14 4
22 54
0 72
45 15
44 61
50 23
38 40
5 53
23 10
77 54
3 20
78 15
64 9
42 11
16 64
37 66
21 17
76 15
23 18
12 54
74 29
21 20
10 29
77 24
25 44
79 55
76 71
1 37
26 1
40 16
33 44
42 21
49 15
40 61
20 11
60 61
0 23
77 32
70 34
39 44
55 26
6 28
42 25
13 23
18 32
49 50
44 54
6 46
1...

output:

1
1
1
1
1
0
1
1
1
1
1
0
0
1
0
1
1
0
1
1
0
0
0
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #120:

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

input:

80
54 59
47 66
0 75
23 0
33 17
13 68
29 38
31 6
9 59
71 78
54 51
22 6
60 69
58 24
50 72
19 77
12 64
11 22
54 55
47 5
33 52
51 24
37 42
26 8
65 49
66 12
46 31
47 50
26 68
51 50
71 37
59 20
47 36
52 58
42 50
61 7
65 16
33 75
17 18
71 45
57 7
42 73
44 3
49 14
12 72
78 61
0 36
58 55
14 59
75 26
10 62
40...

output:

1
1
1
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #121:

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

input:

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

output:

1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #122:

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

input:

80
79 78
77 79
78 77
79 76
78 76
77 76
79 75
75 78
77 75
76 75
74 79
74 78
77 74
74 76
75 74
79 73
73 78
77 73
73 76
75 73
73 74
72 79
78 72
77 72
72 76
72 75
74 72
72 73
71 79
78 71
71 77
76 71
71 75
74 71
71 73
72 71
79 70
70 78
70 77
70 76
70 75
70 74
73 70
70 72
70 71
69 79
69 78
69 77
69 76
69 ...

output:

1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #123:

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

input:

80
59 52
23 59
37 31
7 72
69 54
23 27
37 46
61 57
9 23
59 31
59 73
6 54
42 17
0 3
52 58
67 39
21 72
59 30
73 35
37 75
78 31
75 77
24 3
34 19
59 14
10 3
42 33
72 48
49 44
70 60
21 17
1 47
33 22
34 29
29 70
1 8
35 66
63 29
22 10
15 26
60 4
36 52
48 53
2 49
45 11
14 72
64 5
1 40
45 19
15 7
63 26
42 65
...

output:

1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
1
0
0
1
0
0
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #124:

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

input:

80
29 59
7 20
36 43
27 1
39 6
51 50
11 53
15 69
25 22
54 44
54 28
64 23
51 66
11 55
65 37
2 57
76 45
73 45
5 11
34 75
28 41
54 19
31 73
70 32
45 55
43 68
76 29
5 52
12 56
18 70
14 15
50 5
77 11
54 25
20 26
70 68
59 56
76 19
29 26
41 79
12 8
49 39
15 1
38 14
14 46
72 70
59 50
46 13
44 67
65 36
45 33
...

output:

1
1
1
1
1
1
1
1
1
1
0
1
0
0
1
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
...

result:

ok correct

Test #125:

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

input:

80
74 35
75 43
6 17
21 64
17 52
70 31
63 3
57 42
67 31
48 9
37 44
79 72
54 53
32 58
9 13
59 54
58 51
38 10
52 44
79 64
45 52
41 39
59 73
36 20
72 33
42 66
69 55
8 79
15 27
1 3
22 37
38 23
52 16
60 40
69 28
16 67
58 72
39 12
50 13
50 62
69 32
77 37
45 37
51 62
31 20
42 75
35 11
0 68
49 16
53 37
67 33...

output:

1
1
1
1
0
1
1
1
0
1
1
1
1
1
0
0
0
1
0
0
1
1
1
1
0
0
1
0
1
0
0
0
0
1
0
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #126:

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

input:

80
26 54
22 24
26 9
7 34
39 57
46 32
8 21
9 40
57 56
27 11
69 22
15 64
7 68
4 35
57 11
2 0
32 40
24 31
37 52
36 38
48 6
29 71
50 32
52 49
79 31
53 68
78 56
22 43
55 75
53 20
64 32
22 48
66 77
31 17
11 58
11 69
35 14
18 79
67 55
19 44
61 10
33 74
63 0
70 29
1 77
22 4
10 3
47 68
55 41
59 4
44 28
18 62...

output:

1
1
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
0
0
0
1
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #127:

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

input:

80
61 51
46 16
29 43
67 77
25 53
62 46
77 58
25 71
69 22
68 65
70 61
0 65
14 9
9 37
52 30
19 17
70 53
76 68
76 9
23 71
43 64
77 7
10 77
4 42
40 55
28 10
14 16
4 32
1 49
14 79
23 24
69 2
57 31
7 2
38 54
76 33
20 74
53 11
68 57
50 64
42 47
61 40
24 58
31 69
35 46
7 31
11 50
7 47
22 26
15 64
9 36
76 78...

output:

1
1
1
1
1
0
0
0
1
1
0
0
1
0
1
1
0
0
0
1
0
0
0
1
1
1
0
0
1
0
0
0
1
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #128:

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

input:

80
10 34
47 33
72 68
8 27
63 62
59 8
74 8
47 36
37 24
53 49
34 77
41 49
54 18
4 5
12 65
27 77
68 15
53 78
28 70
74 36
65 55
12 78
57 33
36 65
54 27
5 39
63 45
78 62
28 33
77 36
4 54
40 57
34 63
65 47
55 37
34 17
70 17
27 74
24 39
9 47
27 0
12 72
77 45
65 28
12 45
38 10
34 4
77 37
53 8
45 36
74 39
27...

output:

1
1
1
1
1
0
0
0
1
1
0
0
1
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #129:

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

input:

80
15 35
37 41
35 8
14 67
55 66
36 66
57 40
15 59
14 30
40 23
58 43
43 18
54 18
59 77
15 3
79 23
49 37
66 16
37 58
57 30
30 66
19 40
55 63
27 6
41 49
15 51
27 54
3 54
15 63
63 49
8 33
63 19
51 66
8 15
49 56
45 8
23 30
23 57
48 35
49 54
49 10
33 57
16 19
19 48
8 27
63 3
66 46
71 18
36 30
51 8
33 59
2...

output:

1
1
0
1
1
0
1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
...

result:

ok correct

Test #130:

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

input:

80
40 75
40 39
35 16
26 78
25 34
26 15
21 25
17 53
47 38
68 33
15 40
31 74
33 56
56 65
29 34
74 52
59 74
36 53
70 0
58 25
33 39
57 56
41 4
68 22
16 17
39 53
47 30
64 31
17 8
64 57
47 57
27 19
41 38
27 51
68 51
38 57
57 27
33 27
23 78
70 23
30 35
69 64
65 68
30 37
68 48
56 58
70 69
0 78
22 21
36 35
3...

output:

1
0
1
1
1
0
0
1
1
1
0
1
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
...

result:

ok correct

Test #131:

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

input:

80
66 60
74 16
7 43
11 60
55 75
78 61
78 11
6 75
77 73
36 41
11 44
16 40
15 27
2 64
75 74
36 78
74 46
41 46
44 23
75 79
45 75
13 27
5 62
64 60
55 16
7 36
6 27
44 32
43 5
8 41
2 6
5 36
73 45
40 2
60 27
15 13
75 8
44 64
40 46
44 79
11 62
41 15
11 30
2 27
32 73
11 36
7 77
6 32
43 77
8 30
2 45
23 64
5 3...

output:

1
1
1
0
1
1
0
0
1
1
1
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #132:

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

input:

80
26 38
71 47
15 52
70 44
72 66
25 23
31 9
44 71
6 79
59 49
6 38
71 38
71 25
25 52
73 60
26 44
25 26
57 15
26 2
57 59
73 5
5 72
70 77
54 26
49 57
71 57
5 41
2 6
27 6
31 63
60 3
25 45
41 27
32 59
23 52
79 9
77 38
41 14
26 72
2 52
56 15
23 27
72 9
70 32
32 73
6 25
14 77
27 70
25 54
77 30
2 45
60 6
70...

output:

1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #133:

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

input:

514
401 94
52 422
361 428
224 345
410 259
280 109
37 171
381 442
441 55
110 68
395 106
108 248
362 0
201 349
261 393
452 159
503 402
389 340
311 294
32 495
172 242
14 312
48 248
4 277
441 379
272 296
309 322
264 44
355 104
72 512
349 382
114 487
66 366
214 4
233 181
109 7
337 280
426 393
504 5
377 3...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
0
1
1
0
1
0
0
0
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
1
1
0
1
1
1
0
0
0
1
1
1
1
0
1
1
1
1
1
1
0
1
1
0
0
1
0
1
0
0
0
1
1
0
0
1
0
0
0
1
0
0
0
0
1
1
1
1
1
0
1
1
1
0
0
1
0
1
0
1
0
1
1
0
0
0
0
1
0
0
1
1
1
1
0
0
1
0
0
0
1
0
0
0
0
0
1
0
1
0
0
1
0
0
1
...

result:

ok correct

Test #134:

score: 0
Accepted
time: 19ms
memory: 10276kb

input:

514
89 166
227 81
274 479
435 388
224 385
115 350
269 303
486 445
175 369
249 11
34 368
484 347
429 373
265 178
338 184
459 287
291 26
475 361
499 58
100 292
261 256
77 184
447 509
13 81
304 262
307 391
241 261
233 95
199 30
512 50
83 98
400 32
138 162
402 153
492 505
292 497
146 427
362 284
26 126
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
0
1
1
1
1
1
1
1
1
0
1
1
0
0
0
1
1
0
0
1
1
1
1
0
0
1
1
1
1
0
1
0
0
0
0
1
1
0
0
0
1
1
0
0
0
0
1
0
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
1
0
0
1
0
1
1
0
0
1
0
1
0
1
1
0
0
0
0
1
0
1
0
1
1
0
0
0
1
1
1
0
1
1
1
1
1
1
0
0
0
1
0
0
0
...

result:

ok correct

Test #135:

score: 0
Accepted
time: 17ms
memory: 9788kb

input:

514
276 477
105 384
184 260
179 334
69 427
0 9
232 159
79 317
377 226
108 183
294 410
87 219
136 197
303 407
500 443
187 45
292 28
10 127
235 244
481 407
267 350
183 165
319 179
375 438
391 52
322 432
468 245
65 374
85 348
435 424
303 191
414 350
299 34
375 378
475 94
204 473
84 268
26 273
134 224
4...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
0
0
1
0
1
1
1
1
1
1
1
0
1
0
1
1
0
0
1
1
1
1
0
1
0
1
1
1
0
0
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
0
1
1
1
0
0
0
1
0
0
0
1
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
1
0
0
0
0
1
1
0
0
0
0
0
1
1
0
1
0
0
0
1
1
0
1
1
0
1
0
0
0
1
0
0
0
0
...

result:

ok correct

Test #136:

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

input:

514
368 424
236 247
405 492
203 309
222 174
141 77
348 284
260 130
300 54
365 137
242 17
46 296
242 19
223 334
107 319
21 116
458 242
432 41
158 362
310 169
420 94
499 449
74 423
123 429
334 176
93 152
231 193
437 114
73 395
314 78
204 359
87 370
174 5
372 427
193 447
509 283
358 287
266 328
466 247...

output:

1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
1
1
0
0
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
0
1
0
0
1
0
1
1
0
0
0
1
0
1
1
1
1
0
0
0
0
1
0
1
0
0
1
0
1
1
1
1
0
0
0
1
0
0
0
1
1
0
0
0
0
1
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
1
1
0
0
1
0
0
1
1
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
1
...

result:

ok correct

Test #137:

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

input:

514
13 325
275 329
253 201
328 507
369 177
400 451
114 173
112 425
67 414
219 333
420 328
18 207
470 250
66 117
13 468
395 453
104 101
277 39
311 126
357 444
420 38
440 92
395 194
208 429
307 27
251 366
78 470
231 87
414 413
413 232
127 218
275 214
347 244
437 188
85 495
64 372
85 488
139 93
222 187...

output:

1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
0
1
0
1
1
0
1
1
1
1
0
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
1
0
1
0
1
0
0
1
0
0
0
0
1
1
1
1
1
1
0
1
1
1
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
0
1
0
0
0
0
1
0
1
0
0
0
0
1
1
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
0
0
0
1
0
1
0
1
0
0
0
1
0
1
1
0
0
1
0
...

result:

ok correct

Test #138:

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

input:

514
212 186
264 171
442 238
469 466
380 322
287 158
199 276
160 465
425 226
101 491
200 153
95 375
395 247
279 423
53 165
224 457
75 279
164 129
161 462
437 46
203 253
57 239
145 252
192 356
159 414
217 299
46 302
88 100
54 508
149 88
185 106
79 93
245 290
227 401
215 39
39 15
472 229
59 444
204 48
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
0
1
1
0
1
0
1
0
1
1
0
1
0
0
1
1
0
0
1
1
1
0
1
1
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
1
1
0
1
0
0
1
0
0
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
0
0
0
0
0
0
0
0
1
1
0
...

result:

ok correct

Test #139:

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

input:

514
259 222
118 89
113 168
293 429
298 419
29 72
435 167
371 115
416 67
186 469
235 488
96 362
311 23
177 268
496 202
285 127
205 15
218 229
184 208
31 147
450 284
476 211
430 48
247 239
93 115
185 234
6 383
163 508
401 41
160 30
96 441
54 491
5 422
304 260
251 378
297 244
116 27
265 150
470 274
133...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
1
1
0
1
1
1
0
1
1
0
0
1
0
1
1
1
0
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
0
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
0
1
0
1
1
0
0
0
1
0
0
0
0
1
1
0
0
0
1
1
1
1
0
0
1
1
0
1
0
0
0
...

result:

ok correct

Test #140:

score: 0
Accepted
time: 17ms
memory: 9316kb

input:

514
442 162
127 482
26 10
255 213
335 34
458 13
504 64
15 227
461 210
465 373
144 423
100 438
455 10
43 369
124 162
349 398
139 322
239 273
138 346
315 33
157 372
478 487
106 148
458 492
264 337
133 214
151 65
475 513
170 130
513 11
355 434
74 254
251 390
511 410
262 339
42 179
433 248
331 425
45 41...

output:

1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
0
1
0
1
1
1
0
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
0
0
0
0
0
1
0
1
0
0
1
0
1
0
0
1
0
1
1
0
0
0
0
1
1
1
1
1
0
1
1
1
1
0
1
0
1
0
0
1
1
1
1
1
0
1
1
1
1
0
1
0
0
0
0
0
0
1
1
0
1
0
1
0
0
1
0
1
...

result:

ok correct

Test #141:

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

input:

514
65 218
458 451
171 92
185 76
156 258
329 300
387 480
43 477
421 229
351 280
331 257
192 85
335 31
347 124
3 443
50 295
331 492
84 417
78 157
249 259
159 360
353 101
374 211
484 7
88 403
419 85
434 223
177 275
302 260
20 208
279 237
351 495
119 65
409 476
430 462
501 503
421 116
87 343
198 157
50...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
0
0
0
1
1
1
0
1
0
1
1
1
1
1
1
0
0
0
1
1
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
1
0
0
1
0
0
1
0
0
1
0
1
1
1
0
1
1
0
0
0
0
1
0
1
0
0
0
...

result:

ok correct

Test #142:

score: 0
Accepted
time: 17ms
memory: 9648kb

input:

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

output:

1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #143:

score: 0
Accepted
time: 17ms
memory: 9964kb

input:

514
512 513
513 511
511 512
513 510
510 512
510 511
509 513
512 509
509 511
510 509
508 513
512 508
511 508
510 508
509 508
513 507
512 507
511 507
510 507
507 509
508 507
506 513
506 512
506 511
510 506
506 509
506 508
507 506
513 505
512 505
505 511
510 505
505 509
508 505
505 507
505 506
504 513
...

output:

1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #144:

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

input:

514
86 351
197 452
426 69
232 2
362 366
456 392
173 152
407 512
165 204
244 14
288 384
390 84
4 220
85 232
318 203
222 245
214 223
414 69
163 69
125 137
219 241
55 501
482 186
48 17
259 390
396 15
476 487
176 339
380 104
285 261
258 54
284 407
238 280
440 16
420 284
33 214
483 367
390 512
24 501
176...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
0
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
1
1
0
1
1
0
0
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
0
1
1
0
1
0
1
1
1
0
1
1
1
0
0
1
1
1
1
1
1
0
0
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
0
0
1
1
0
0
1
1
1
0
0
1
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
0
1
0
...

result:

ok correct

Test #145:

score: 0
Accepted
time: 17ms
memory: 9228kb

input:

514
307 97
35 108
293 439
152 467
210 221
109 464
301 258
58 48
78 414
93 1
427 14
506 333
0 78
54 158
46 35
387 209
109 482
167 340
196 137
217 263
390 294
185 361
462 376
295 331
128 141
368 430
139 426
420 231
33 49
321 117
113 311
267 163
451 236
493 7
326 175
107 320
274 159
80 309
309 496
419 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
0
1
0
0
1
0
0
0
1
1
1
1
0
0
1
0
1
0
0
1
0
0
1
1
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
0
1
0
1
0
1
1
0
0
1
0
1
0
0
0
0
0
1
0
1
1
0
0
0
0
0
...

result:

ok correct

Test #146:

score: 0
Accepted
time: 10ms
memory: 9272kb

input:

514
355 43
499 5
46 165
29 183
26 205
291 307
218 240
53 36
131 485
503 236
373 398
67 306
421 188
143 92
146 391
500 508
327 508
288 388
19 206
161 313
314 448
324 300
395 245
249 122
296 476
331 223
264 29
455 287
182 481
164 155
505 60
183 86
505 259
173 421
391 200
443 54
415 509
419 179
501 178...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
0
0
0
1
1
1
1
1
1
0
0
1
1
0
1
0
0
1
0
1
1
1
0
1
0
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
0
0
1
0
1
1
0
1
1
0
0
1
1
1
1
1
1
1
0
0
0
1
0
1
0
1
0
1
1
1
0
0
0
0
0
0
0
1
0
1
1
1
0
1
0
0
0
1
0
0
1
1
0
0
0
0
0
1
1
0
1
0
1
1
1
0
0
0
1
1
0
...

result:

ok correct

Test #147:

score: 0
Accepted
time: 17ms
memory: 9336kb

input:

514
502 44
352 11
382 155
154 12
236 419
216 402
126 66
253 451
225 480
435 222
115 209
240 403
455 319
45 499
26 388
221 245
315 372
385 176
5 354
171 472
28 48
244 150
110 305
5 452
96 290
90 285
172 371
90 352
358 410
250 446
19 339
156 503
461 247
92 471
380 239
349 60
73 209
73 137
458 290
111 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
0
1
0
1
0
0
0
1
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
0
1
1
1
0
1
0
1
1
1
0
0
0
1
1
1
0
0
1
0
1
0
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
1
1
1
1
1
0
1
1
0
1
1
0
1
0
0
1
0
0
0
0
0
1
0
1
1
...

result:

ok correct

Test #148:

score: 0
Accepted
time: 17ms
memory: 9944kb

input:

514
210 389
204 459
309 292
442 261
488 445
434 149
513 482
424 71
97 228
142 9
167 98
287 452
510 391
331 411
276 143
154 78
6 377
94 474
322 286
45 439
325 176
106 57
155 249
320 419
449 371
259 140
437 459
383 265
316 208
97 112
438 53
96 80
34 437
285 437
274 424
275 55
348 364
139 65
266 256
23...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
0
1
1
0
0
0
0
1
0
0
0
1
1
1
0
1
0
0
0
1
0
0
1
1
1
0
0
1
1
0
1
0
1
1
1
0
1
1
1
1
0
0
1
0
1
1
0
1
1
0
1
0
1
1
0
0
0
0
1
1
1
1
0
1
0
0
0
0
1
0
1
0
1
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
...

result:

ok correct

Test #149:

score: 0
Accepted
time: 17ms
memory: 9116kb

input:

514
365 108
443 145
45 176
434 486
447 422
450 384
213 384
412 474
178 453
509 15
179 101
500 458
18 54
489 28
276 451
205 511
476 18
253 34
398 45
364 186
506 202
234 15
431 80
77 145
76 329
57 131
118 164
414 210
448 441
397 34
229 202
416 448
255 503
144 90
381 297
35 177
442 466
422 401
163 98
4...

output:

1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
0
1
0
1
1
1
1
1
0
0
0
1
1
1
1
1
0
1
0
0
1
1
1
0
1
1
1
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
0
0
0
1
0
1
1
0
0
1
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
0
0
0
0
1
0
0
0
0
1
0
1
1
0
0
0
1
1
1
1
0
0
0
1
0
0
1
0
0
1
0
1
1
0
1
1
0
1
0
0
0
1
0
1
0
1
0
0
...

result:

ok correct

Test #150:

score: 0
Accepted
time: 17ms
memory: 9644kb

input:

514
218 78
291 9
508 235
151 104
267 214
173 440
90 355
42 274
216 136
212 149
244 264
76 0
501 432
237 146
400 456
218 333
465 188
35 219
377 457
290 336
405 314
154 212
119 171
230 335
322 84
166 74
381 207
465 230
54 352
501 149
268 153
118 309
307 255
446 505
267 137
212 256
145 456
51 201
99 22...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
1
1
0
1
1
1
1
1
0
0
0
1
1
1
0
1
1
1
1
1
1
0
0
0
0
0
0
0
1
1
1
0
1
1
0
1
1
0
0
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
1
0
0
0
0
1
0
1
0
0
1
0
0
1
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
1
0
1
0
0
1
1
0
1
0
1
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
1
...

result:

ok correct

Test #151:

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

input:

514
218 316
249 272
46 425
76 24
409 221
224 356
221 77
83 278
340 418
114 407
368 299
40 414
169 55
169 270
119 454
368 276
394 488
53 106
442 265
344 457
294 91
327 464
29 21
105 370
198 1
162 348
109 296
378 53
511 301
445 485
54 169
168 409
184 356
465 14
377 115
501 337
6 219
91 263
103 265
78 ...

output:

1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
0
1
0
1
1
1
1
1
0
1
0
1
1
0
0
0
0
1
0
0
1
0
1
1
1
0
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
...

result:

ok correct

Test #152:

score: 0
Accepted
time: 15ms
memory: 10812kb

input:

514
149 101
303 353
378 19
359 299
182 8
363 233
219 83
314 215
170 388
356 244
251 96
330 80
162 358
234 300
22 184
278 244
5 109
90 338
338 318
246 282
277 435
454 437
379 3
237 493
271 423
129 502
30 126
168 211
125 49
271 193
91 26
300 298
394 170
336 305
459 388
75 251
365 468
383 472
508 472
1...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
1
0
1
0
0
0
1
1
1
1
1
1
1
0
0
1
0
0
0
1
1
0
1
1
1
0
0
0
1
0
0
1
0
0
1
0
1
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
0
0
1
0
0
1
0
1
0
0
1
0
0
0
0
1
0
0
0
0
1
1
0
1
0
1
0
0
0
0
0
0
1
0
0
...

result:

ok correct

Test #153:

score: 0
Accepted
time: 12ms
memory: 9896kb

input:

514
70 441
240 364
212 317
53 51
202 108
468 97
379 267
411 495
174 157
380 502
133 314
129 298
92 82
124 14
45 22
509 505
241 248
27 282
268 154
208 426
418 222
357 345
82 314
360 130
296 248
256 199
97 30
27 326
508 15
513 384
180 370
391 344
96 174
26 359
67 346
365 28
197 428
180 198
312 498
257...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
1
0
0
0
1
1
0
0
1
0
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
0
0
0
1
1
0
1
1
0
1
1
1
0
1
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
1
1
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
...

result:

ok correct

Test #154:

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

input:

777
144 59
33 673
174 481
347 756
757 221
488 67
425 511
179 330
586 35
463 270
97 66
457 577
635 496
236 363
141 690
747 414
619 501
667 168
199 154
213 615
101 375
290 690
31 136
202 215
738 268
533 707
564 714
772 250
663 64
549 562
171 354
533 571
42 324
707 2
700 105
578 4
585 426
618 509
719 2...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
1
1
0
1
1
0
1
0
1
0
1
1
0
1
0
0
0
0
1
0
1
1
0
1
0
0
1
0
1
1
1
1
1
1
0
1
0
0
0
0
0
0
0
1
0
1
1
0
1
1
1
1
0
1
1
1
1
1
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
0
1
1
0
...

result:

ok correct

Test #155:

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

input:

777
417 680
536 56
721 228
202 87
105 346
338 426
686 109
623 34
98 109
127 737
143 4
444 55
300 28
453 491
279 426
727 275
61 217
477 210
106 521
665 258
656 94
42 320
592 404
154 408
17 512
652 166
548 722
699 609
228 512
440 299
50 549
135 495
476 649
90 42
216 55
155 735
219 387
606 537
145 447
...

output:

1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
0
0
0
0
1
0
1
0
1
0
0
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
0
1
1
0
1
1
0
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
...

result:

ok correct

Test #156:

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

input:

777
431 150
189 552
711 697
372 523
544 287
188 205
639 715
337 310
635 361
597 128
154 705
387 585
153 680
541 166
21 664
567 265
487 74
733 690
65 202
600 461
184 711
133 538
687 683
293 429
346 160
561 671
332 728
20 198
273 483
437 56
684 518
367 368
306 489
564 619
335 160
702 152
505 470
550 2...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
0
1
1
1
0
0
1
1
1
1
0
0
0
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
0
0
0
0
1
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
0
0
1
0
1
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
1
0
1
1
1
0
1
0
0
0
0
1
0
0
0
0
0
...

result:

ok correct

Test #157:

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

input:

777
44 349
212 680
388 477
2 105
597 323
161 466
227 737
329 694
109 221
351 518
174 351
35 590
408 57
752 24
338 323
396 334
138 188
96 405
716 43
35 634
355 178
64 501
26 679
410 423
558 655
681 493
135 677
680 378
668 218
357 27
652 716
62 335
112 683
260 270
625 272
514 641
40 79
435 622
77 449
...

output:

1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
0
1
1
0
1
1
1
1
0
0
1
1
1
1
1
0
1
1
0
1
1
1
1
0
1
1
0
1
0
1
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
0
1
1
0
0
1
1
1
0
0
1
0
1
1
1
0
0
1
0
1
1
1
0
1
0
0
0
0
1
0
0
1
1
0
0
1
0
0
0
1
0
1
1
0
0
1
0
1
0
...

result:

ok correct

Test #158:

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

input:

777
523 211
699 442
438 551
541 4
395 192
663 161
167 194
400 354
692 208
394 122
131 166
299 329
258 668
600 468
455 462
630 63
1 557
758 285
200 224
275 619
531 55
58 337
635 703
579 242
625 101
106 152
124 150
474 746
277 1
555 369
577 338
488 420
558 254
371 41
713 181
567 229
37 64
388 269
716 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
0
1
1
0
0
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
0
0
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
1
1
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
1
1
1
1
0
1
1
0
1
1
1
0
1
1
0
1
1
1
1
0
0
...

result:

ok correct

Test #159:

score: 0
Accepted
time: 34ms
memory: 10992kb

input:

777
577 383
312 758
726 76
489 752
326 322
3 124
348 682
252 276
140 37
432 707
762 641
14 341
641 373
405 655
600 645
589 120
610 606
734 742
580 417
761 187
307 297
626 605
504 520
574 368
649 228
111 253
398 187
767 451
420 374
378 524
127 531
487 439
431 729
167 690
764 219
351 742
551 501
405 2...

output:

1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
0
1
0
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
1
1
0
0
0
1
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
0
1
1
1
1
1
0
0
1
1
1
0
1
1
1
1
0
1
0
1
1
1
1
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
1
0
0
1
0
1
1
0
1
1
...

result:

ok correct

Test #160:

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

input:

777
358 367
557 87
603 717
119 603
300 561
118 217
390 742
269 604
455 531
688 109
329 704
225 719
250 385
561 550
620 730
278 66
477 774
264 8
767 74
112 404
83 19
509 45
441 591
380 605
263 174
188 152
118 86
13 535
533 12
720 221
504 661
297 267
30 67
33 405
247 18
223 103
449 713
573 371
334 78
...

output:

1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
0
1
1
1
1
1
0
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
1
0
1
0
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
0
1
1
0
1
1
0
1
1
0
1
0
1
0
1
1
0
0
0
1
1
1
1
1
1
1
1
1
0
0
1
1
1
0
1
1
1
0
1
0
1
0
0
1
0
1
1
0
0
1
0
1
0
0
1
1
1
...

result:

ok correct

Test #161:

score: 0
Accepted
time: 34ms
memory: 12208kb

input:

777
626 222
361 166
353 38
57 330
147 625
618 514
418 4
360 381
268 578
341 23
176 448
487 701
556 77
292 478
272 259
22 489
706 103
632 234
524 680
329 240
692 130
45 513
618 762
426 196
394 29
759 488
194 132
496 131
640 765
121 557
715 392
701 441
718 388
746 486
255 348
140 656
358 198
672 298
1...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
0
1
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
1
1
1
0
1
1
1
1
1
0
1
1
0
0
1
1
0
1
0
1
0
0
0
0
1
0
0
0
1
1
1
1
1
1
1
0
0
0
0
0
1
1
1
1
1
...

result:

ok correct

Test #162:

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

input:

777
371 32
436 285
46 362
639 608
207 501
623 683
526 551
96 480
202 630
327 464
96 670
639 395
87 159
398 454
611 617
264 730
140 66
145 526
702 602
162 523
600 408
324 736
510 233
449 430
492 126
378 204
276 464
97 470
368 722
601 700
123 506
47 119
364 377
317 336
32 246
115 613
399 67
463 426
72...

output:

1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
1
1
1
0
1
0
1
1
0
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
0
0
1
1
0
0
0
1
1
0
0
0
1
0
1
1
1
1
1
1
0
1
0
1
1
0
1
1
0
1
1
0
0
1
0
1
1
1
1
1
0
1
1
0
0
0
1
0
0
1
...

result:

ok correct

Test #163:

score: 0
Accepted
time: 65ms
memory: 13712kb

input:

1024
841 757
25 470
461 542
379 567
380 156
886 644
269 914
916 952
562 383
511 186
200 49
284 494
525 300
165 433
102 1002
559 504
911 357
862 391
431 111
150 987
732 989
420 508
23 443
143 471
918 429
313 946
323 945
620 174
1023 833
318 1018
123 141
670 737
546 882
213 2
847 77
954 447
585 270
45...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
1
1
0
1
1
1
0
1
1
0
0
0
0
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
0
...

result:

ok correct

Test #164:

score: 0
Accepted
time: 66ms
memory: 13840kb

input:

1024
190 126
557 103
157 857
529 357
221 350
606 73
602 636
408 598
632 607
108 755
460 712
102 482
486 379
797 476
160 762
76 10
493 759
959 149
454 321
273 371
526 797
612 697
104 296
181 707
563 954
929 547
728 772
935 606
457 190
213 1009
992 513
825 559
695 611
338 587
672 834
946 328
469 914
8...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
1
0
1
0
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
1
1
0
1
1
0
1
1
1
0
1
0
1
1
1
1
1
0
1
1
1
1
1
0
1
0
1
...

result:

ok correct

Test #165:

score: 0
Accepted
time: 67ms
memory: 11844kb

input:

1024
773 802
175 575
860 251
967 964
887 82
132 602
87 571
980 95
323 399
11 333
106 255
890 745
290 701
303 155
151 2
634 84
1011 123
490 857
78 556
723 670
845 1000
945 872
487 726
529 994
763 169
664 399
1001 580
803 137
429 751
306 67
153 383
190 1002
1013 1005
816 917
742 22
1002 722
646 664
64...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
0
0
1
0
1
1
1
1
1
0
1
0
0
0
1
1
1
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
1
0
0
1
1
1
1
0
0
1
0
1
1
1
...

result:

ok correct

Test #166:

score: 0
Accepted
time: 71ms
memory: 13644kb

input:

1024
273 318
302 1012
765 628
397 833
696 31
517 169
925 438
889 353
385 767
848 63
60 74
333 283
394 414
759 3
346 131
350 423
595 93
146 271
287 953
677 356
978 675
414 754
929 976
784 521
778 361
174 956
0 529
60 1000
278 797
1011 735
817 287
298 161
113 653
322 479
633 594
859 45
300 656
861 272...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
0
0
1
1
1
0
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
0
1
0
1
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
0
0
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
0
0
0
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
0
1
1
1
0
0
1
...

result:

ok correct

Test #167:

score: 0
Accepted
time: 64ms
memory: 11876kb

input:

1024
108 241
781 962
95 170
209 255
625 719
803 315
968 993
863 446
676 508
73 291
699 403
969 118
88 554
940 289
930 766
173 984
649 877
578 419
280 987
1009 776
273 632
56 94
340 15
670 461
478 119
648 773
307 916
587 312
1012 931
421 613
972 88
991 930
936 771
326 142
188 663
218 116
532 170
817 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
0
1
0
1
0
1
1
1
1
1
0
1
0
0
1
0
1
1
0
0
1
1
1
1
1
1
0
1
0
0
1
1
0
1
1
1
1
1
0
1
1
0
0
1
0
0
1
1
1
1
0
1
1
0
1
1
0
1
0
1
0
...

result:

ok correct

Test #168:

score: 0
Accepted
time: 63ms
memory: 12852kb

input:

1024
394 587
758 596
212 502
64 840
484 637
966 505
156 386
300 766
995 136
922 748
900 319
737 921
400 729
487 641
490 254
582 681
461 84
838 135
913 653
654 299
515 119
72 631
447 596
388 402
174 58
236 694
574 813
189 128
172 392
886 239
122 429
129 362
18 643
70 608
755 702
356 319
482 689
586 4...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
0
0
1
0
1
0
1
0
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
1
1
0
0
1
1
1
0
0
1
0
0
1
1
0
1
0
0
1
1
1
1
1
0
1
...

result:

ok correct

Test #169:

score: 0
Accepted
time: 64ms
memory: 11720kb

input:

1024
874 931
110 509
872 666
538 57
0 818
261 737
691 127
415 486
428 614
378 629
623 626
943 94
133 244
642 493
947 161
981 873
357 894
147 203
584 260
512 775
241 855
630 206
761 20
486 159
179 629
971 492
159 1005
408 945
734 325
236 676
20 369
160 204
643 385
989 851
886 953
663 869
744 397
687 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
0
1
0
1
1
1
1
1
1
0
0
1
0
1
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
1
1
0
0
1
1
0
1
1
0
1
0
0
1
0
...

result:

ok correct

Test #170:

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

input:

1024
132 740
571 822
410 95
173 957
879 33
839 675
432 376
544 364
825 431
575 235
605 55
502 194
223 120
499 183
616 84
528 487
830 297
1011 923
677 689
447 200
1005 283
908 203
688 299
809 202
887 992
708 994
624 1005
713 409
799 913
35 199
856 502
848 513
849 498
708 49
16 723
509 76
995 923
934 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
0
1
0
1
1
1
1
1
1
0
0
1
0
1
0
1
1
0
0
0
1
1
1
1
0
1
1
0
1
1
0
1
1
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
0
0
0
0
0
0
0
0
1
...

result:

ok correct

Test #171:

score: 0
Accepted
time: 63ms
memory: 12868kb

input:

1024
905 482
935 1023
24 54
510 883
504 283
31 112
464 895
247 86
259 180
922 27
825 1001
125 96
717 482
542 646
84 862
374 586
665 652
631 863
552 647
354 809
646 61
393 488
668 492
338 182
497 329
305 241
731 422
620 700
232 395
116 619
845 158
705 354
822 175
821 911
173 692
225 55
65 22
15 89
49...

output:

1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
0
1
0
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
0
1
1
0
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
0
0
1
1
0
1
0
1
0
1
0
0
1
1
0
0
1
1
1
1
0
0
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
0
1
1
0
1
1
0
0
1
1
1
0
0
1
1
0
...

result:

ok correct

Test #172:

score: 0
Accepted
time: 159ms
memory: 13968kb

input:

1500
1226 371
17 390
267 1199
547 823
1436 1271
1424 889
1058 1338
432 595
630 230
1486 1284
196 33
692 1222
852 186
1053 1093
68 509
945 922
589 217
1107 949
1042 73
98 1061
991 1338
248 882
15 1331
93 1428
434 253
193 1418
500 846
451 113
786 387
196 1113
81 246
348 436
304 773
758 1
1492 51
1059 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
0
0
1
0
1
1
1
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
0
0
1
0
0
1
1
1
1
0
...

result:

ok correct

Test #173:

score: 0
Accepted
time: 155ms
memory: 14028kb

input:

1500
1486 122
192 1175
1418 1031
859 1492
447 964
388 640
319 1328
438 685
104 293
612 734
676 697
514 1137
1029 826
1264 1143
459 616
1016 994
804 1085
456 60
898 28
880 240
853 99
406 1391
177 190
899 1315
74 292
411 423
194 291
1415 947
326 1309
1301 258
732 806
189 1227
1393 289
133 586
641 705
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
0
1
1
1
1
1
1
0
1
1
1
0
0
0
1
1
0
1
0
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
...

result:

ok correct

Test #174:

score: 0
Accepted
time: 154ms
memory: 15864kb

input:

1500
277 870
620 564
164 874
956 1291
548 886
485 1278
754 219
1051 1195
1445 1229
306 1461
923 371
1436 727
1429 1385
1337 787
439 1312
1388 470
1073 168
1487 432
1044 502
1231 1298
1303 277
1245 1339
153 192
911 623
1358 1386
683 1105
1361 1391
94 526
969 1460
299 644
397 982
1437 862
952 1211
184...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
0
1
0
1
0
1
1
1
1
1
0
0
0
1
1
0
1
1
1
1
1
1
1
1
1
0
0
1
1
0
1
1
0
1
0
0
0
0
1
1
1
1
1
1
1
1
0
0
1
1
1
1
0
1
0
0
0
0
1
...

result:

ok correct

Test #175:

score: 0
Accepted
time: 160ms
memory: 13808kb

input:

1500
554 177
1128 601
392 1188
604 841
1286 762
1339 655
1107 320
1367 386
799 1398
1050 1383
1197 476
474 643
1139 526
301 454
1035 741
969 609
1137 274
361 966
257 1391
933 1016
749 701
1479 223
384 617
1465 830
1070 60
987 524
835 1498
1330 665
741 9
860 786
447 517
67 167
1355 71
97 492
875 102
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
0
0
1
1
0
1
1
0
1
0
1
1
1
1
0
0
1
0
1
1
0
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
...

result:

ok correct

Test #176:

score: 0
Accepted
time: 158ms
memory: 15944kb

input:

1500
1147 291
897 225
205 1300
1077 1465
1063 967
1239 1270
602 663
1094 787
1129 1114
951 709
58 1226
1016 1442
540 1444
884 251
28 1071
1426 610
1178 123
609 880
1170 95
1012 207
343 1124
170 225
1202 1103
318 1094
942 11
494 868
1244 1169
962 1210
207 1169
1400 653
1393 1360
725 511
1483 50
363 1...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
1
0
1
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
0
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
0
1
0
1
1
1
0
1
1
0
1
1
0
1
1
0
1
...

result:

ok correct

Test #177:

score: 0
Accepted
time: 154ms
memory: 16020kb

input:

1500
703 1064
887 627
72 724
601 1423
45 462
477 1268
1281 1418
766 742
626 637
811 1023
561 1457
389 4
526 883
958 1206
333 235
361 906
651 1314
1251 911
1145 590
942 517
123 957
1348 748
1020 613
1170 670
129 708
200 415
190 1176
1218 522
224 967
130 450
1286 885
1499 240
458 997
1053 556
224 882
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
1
1
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
0
1
1
1
0
0
1
0
1
0
0
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
0
0
1
1
0
0
1
1
1
0
1
0
1
1
...

result:

ok correct

Test #178:

score: 0
Accepted
time: 162ms
memory: 15984kb

input:

1500
1291 804
64 398
833 1032
231 621
358 40
606 782
964 575
1389 28
584 260
718 1045
355 917
33 658
916 872
1204 805
357 632
465 351
67 1105
1403 514
1173 261
249 1267
423 27
201 1378
265 775
720 1113
528 210
860 1015
581 908
243 846
849 1386
1375 1334
956 1121
552 544
907 955
1103 209
730 1361
139...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
1
0
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
1
0
0
0
1
1
1
1
0
1
1
1
1
1
1
0
1
0
0
0
0
1
1
0
1
1
1
1
1
0
...

result:

ok correct

Test #179:

score: 0
Accepted
time: 157ms
memory: 15956kb

input:

1500
1435 366
1455 1163
950 1489
755 326
297 1216
520 295
1194 1164
1085 1082
1239 793
239 1428
152 1030
1119 607
1323 1411
1102 882
1117 1126
1175 82
264 861
1205 909
1341 1449
1309 670
511 1028
1063 1387
1286 1171
652 49
205 1242
660 781
1193 86
1218 638
422 768
19 373
338 853
209 260
497 86
1429 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
0
0
1
1
1
0
0
1
0
0
1
0
0
0
1
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
...

result:

ok correct

Test #180:

score: 0
Accepted
time: 150ms
memory: 15832kb

input:

1500
649 930
1201 481
946 1280
912 616
911 1423
635 617
523 133
959 1236
443 1316
1330 195
98 671
1393 671
955 1368
783 1169
316 456
567 837
945 1214
927 286
183 960
1161 1159
647 940
1491 171
1003 1396
1102 1236
568 912
572 1271
1428 1321
1422 606
679 33
286 163
266 279
860 1157
1396 110
892 741
14...

output:

1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
0
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
1
1
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
1
0
1
0
1
0
1
1
0
1
0
0
1
1
1
0
1
1
1
0
1
1
1
1
0
0
0
1
1
...

result:

ok correct

Test #181:

score: 0
Accepted
time: 128ms
memory: 13672kb

input:

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

output:

1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #182:

score: 0
Accepted
time: 127ms
memory: 13952kb

input:

1500
1499 1498
1497 1499
1498 1497
1496 1499
1496 1498
1496 1497
1495 1499
1495 1498
1495 1497
1495 1496
1494 1499
1494 1498
1497 1494
1496 1494
1494 1495
1499 1493
1493 1498
1497 1493
1496 1493
1495 1493
1494 1493
1492 1499
1492 1498
1492 1497
1492 1496
1492 1495
1492 1494
1493 1492
1491 1499
1498 ...

output:

1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #183:

score: 0
Accepted
time: 164ms
memory: 15956kb

input:

1500
1284 61
65 1060
671 971
1235 848
334 1448
1206 1492
656 889
1479 740
413 855
6 455
139 391
201 681
1419 705
414 1355
257 120
1035 1230
803 1293
869 818
283 640
387 206
1269 1308
915 311
59 1470
368 251
43 928
726 114
867 744
762 434
927 1337
734 1417
322 1058
1228 929
660 1109
67 8
570 200
411 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
0
0
0
1
1
1
0
1
1
1
1
1
...

result:

ok correct

Test #184:

score: 0
Accepted
time: 160ms
memory: 13916kb

input:

1500
67 1166
196 310
209 778
283 961
1289 335
576 316
133 1467
654 1234
529 1042
38 558
270 890
850 15
1391 1186
982 970
821 1447
898 537
1361 1295
1490 982
389 1289
333 121
1202 561
519 99
38 853
637 834
1004 868
513 627
663 743
1363 573
1183 437
1417 555
727 254
718 1046
1374 57
791 65
501 1402
72...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
1
1
0
1
1
1
1
1
0
0
1
1
0
1
1
1
0
1
1
1
1
0
1
0
1
0
1
1
1
1
0
1
1
0
1
0
1
1
0
1
0
1
1
0
0
1
1
0
0
0
0
1
1
0
1
0
1
1
1
...

result:

ok correct

Test #185:

score: 0
Accepted
time: 161ms
memory: 16024kb

input:

1500
1214 400
415 419
705 1078
1029 563
431 533
962 1215
637 1098
861 714
747 606
594 448
536 651
1220 906
11 547
584 1024
1346 23
1289 780
466 40
913 178
705 918
1105 685
345 1
575 527
294 591
1231 776
1270 1102
50 457
191 412
1448 965
469 560
409 949
1398 154
520 423
691 943
968 852
122 922
365 46...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
0
1
1
1
1
1
1
1
0
0
1
1
1
1
0
1
0
1
0
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
0
0
0
1
0
1
1
1
1
1
0
1
0
1
1
0
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
...

result:

ok correct

Test #186:

score: 0
Accepted
time: 163ms
memory: 13972kb

input:

1500
1029 580
855 1321
897 1443
677 764
1339 119
1111 788
500 304
1382 688
1413 721
188 1477
743 185
979 237
319 328
555 383
845 859
306 741
443 1494
993 1203
436 837
206 894
178 1308
523 46
200 596
1254 382
870 1083
831 992
52 519
630 907
971 136
498 404
1464 451
911 1132
324 237
1251 940
554 1301
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
0
1
1
1
0
1
1
0
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
0
0
1
1
1
0
1
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
0
0
1
1
1
0
1
1
0
0
1
1
...

result:

ok correct

Test #187:

score: 0
Accepted
time: 164ms
memory: 13816kb

input:

1500
1033 1152
117 1131
879 1396
862 1055
1241 344
1279 894
791 996
653 92
209 321
1424 1047
184 1456
906 265
937 263
294 1326
1120 846
203 1118
1478 893
315 1111
545 67
1327 1297
8 200
928 1022
622 1116
347 882
958 97
1267 318
472 1358
1213 1258
889 162
1435 1088
978 1344
190 350
174 1352
914 238
4...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
0
0
1
0
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
1
1
0
1
1
1
1
0
1
0
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
0
...

result:

ok correct

Test #188:

score: 0
Accepted
time: 142ms
memory: 15868kb

input:

1500
399 608
145 443
940 968
1268 40
49 1083
225 639
15 1360
981 718
453 178
1176 450
633 549
1390 559
1435 1090
245 1120
891 811
919 1347
926 1437
958 866
919 700
529 1061
758 131
433 1200
80 431
1032 957
167 1174
98 1455
817 1478
1146 181
78 628
1375 1461
5 964
1452 1271
255 503
144 90
730 771
35 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
0
1
0
0
1
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
0
1
1
1
1
0
1
0
0
1
1
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
1
1
1
0
0
0
1
0
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
0
0
0
1
1
0
0
0
0
0
1
1
1
1
0
1
1
0
...

result:

ok correct

Test #189:

score: 0
Accepted
time: 144ms
memory: 13908kb

input:

1500
1042 882
523 719
338 1458
1085 739
381 465
838 1443
992 923
649 581
612 1410
140 544
631 1365
813 775
685 534
112 1460
261 186
1032 596
1326 727
850 551
296 633
850 502
723 588
877 44
873 753
970 361
561 488
73 441
633 563
213 51
568 857
1406 1436
826 1266
56 1100
1125 277
64 890
458 866
585 97...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
0
1
1
0
1
1
0
0
1
1
1
0
0
0
0
1
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
0
0
1
1
0
0
1
0
1
1
0
0
1
0
1
1
0
1
1
0
1
0
1
1
1
1
0
1
0
0
0
1
1
0
1
...

result:

ok correct

Test #190:

score: 0
Accepted
time: 142ms
memory: 13972kb

input:

1500
224 85
833 863
222 240
339 561
74 756
1088 1393
531 76
550 1362
1414 327
674 676
1468 11
791 543
156 402
805 529
1038 501
224 1099
189 1223
953 359
189 1461
1148 1451
1039 1460
547 290
841 1321
83 147
457 851
1410 913
964 659
358 1299
787 707
596 174
583 327
547 963
661 89
790 904
1036 1258
131...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
0
1
1
0
0
0
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
1
0
0
1
1
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
1
0
0
...

result:

ok correct

Test #191:

score: 0
Accepted
time: 132ms
memory: 13780kb

input:

1500
747 339
476 1321
308 771
279 304
815 1016
750 1001
132 701
79 176
1379 1131
793 813
15 359
448 453
1391 180
699 974
741 1147
1458 1414
1351 1283
618 907
776 488
10 14
306 537
620 1142
360 34
1362 311
1460 1225
878 138
1387 47
1225 1055
1403 862
1327 388
1130 189
1253 621
112 1094
717 628
1220 1...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
0
1
1
1
0
0
1
1
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
1
1
0
0
1
1
1
1
1
1
1
1
1
1
0
1
...

result:

ok correct

Test #192:

score: 0
Accepted
time: 141ms
memory: 13996kb

input:

1500
993 515
514 1048
823 1073
487 151
515 711
449 760
901 587
1413 394
166 1120
432 1484
1450 907
998 1433
906 535
687 213
382 1323
1321 871
524 975
185 871
1150 591
1303 440
184 1202
783 844
40 282
583 1154
454 1246
1460 256
453 944
1140 1176
948 1218
857 1416
191 630
221 1368
586 1452
408 1418
13...

output:

1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
0
1
1
1
0
1
1
1
1
1
0
0
1
1
0
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
1
1
1
0
1
1
1
1
0
0
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
0
1
0
1
1
1
0
0
1
1
1
1
0
1
...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed