QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#422445#7303. City UniteddayuxTL 935ms213636kbC++141.6kb2024-05-27 14:41:002024-05-27 14:41:01

Judging History

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

  • [2024-05-27 14:41:01]
  • 评测
  • 测评结果:TL
  • 用时:935ms
  • 内存:213636kb
  • [2024-05-27 14:41:00]
  • 提交

answer

#include <bits/stdc++.h>

const int maxn = 50, maxd = 13, mod = 4;

std::array<int, maxn + 1> e;
std::array<std::array<std::array<short, 1 << maxd>, 1 << maxd>, 2> f;

void inc(short &x, short y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int main() {
  std::cin.tie(nullptr)->sync_with_stdio(false);

  int n, m;
  std::cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    std::cin >> u >> v;
    e[std::max(u, v)] |= 1 << (std::abs(u - v) - 1);
  }

  f[0 & 1][0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int S = 0; S < (1 << maxd); ++S) {
      for (int T = S; ; T = (T - 1) & S) {
        int R = S ^ T;
        f[i & 1][T][R] = 0;
        if (T == 0) {
          break;
        }
      }
    }
    for (int S = 0; S < (1 << maxd); ++S) {
      for (int T = S; ; T = (T - 1) & S) {
        int R = S ^ T;
	    if (f[(i - 1) & 1][T][R] != 0) {
          inc(f[i & 1][(T << 1) & ((1 << maxd) - 1)][(R << 1) & ((1 << maxd) - 1)], f[(i - 1) & 1][T][R]);
          if ((e[i] & R) == 0) {
            inc(f[i & 1][(T << 1 | 1) & ((1 << maxd) - 1)][(R << 1) & ((1 << maxd) - 1)], f[(i - 1) & 1][T][R]);
          }
          if ((e[i] & T) == 0) {
            inc(f[i & 1][(T << 1) & ((1 << maxd) - 1)][(R << 1 | 1) & ((1 << maxd) - 1)], f[(i - 1) & 1][T][R]);
          }
		}
        if (T == 0) {
          break;
        }
      }
    }
  }

  short ans = 0;
  for (int S = 0; S < (1 << maxd); ++S) {
    for (int T = S; ; T = (T - 1) & S) {
      inc(ans, f[n & 1][T][S ^ T]);
      if (T == 0) {
        break;
      }
    }
  }
  std::cout << ans / 2 << "\n";
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 51ms
memory: 213580kb

input:

3 2
1 2
2 3

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

3 3
1 2
2 3
3 1

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 204ms
memory: 213504kb

input:

15 31
9 5
14 5
2 7
5 15
11 14
11 9
2 6
3 4
12 1
6 8
3 5
11 10
15 6
4 1
1 2
8 9
6 12
14 10
13 2
4 5
3 8
3 15
11 6
7 5
4 6
11 2
13 15
3 2
8 4
6 13
7 10

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 216ms
memory: 213580kb

input:

15 92
10 9
15 7
11 1
7 2
12 10
1 12
4 13
1 4
11 5
1 2
4 3
1 9
15 4
11 7
14 1
8 7
8 12
7 4
10 14
7 13
6 13
4 12
11 10
13 8
13 15
10 7
2 14
12 13
14 5
8 4
12 9
7 9
15 10
10 4
11 15
13 10
6 15
8 9
2 8
11 12
5 4
1 6
2 9
10 1
5 6
14 12
5 13
5 10
6 9
15 8
12 15
10 2
5 7
4 6
2 11
12 3
15 9
9 3
3 10
5 2
12 ...

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 206ms
memory: 213516kb

input:

15 80
5 10
10 13
13 4
4 2
6 10
8 6
13 7
13 9
9 5
6 13
6 3
13 14
10 12
8 3
8 13
9 1
7 5
14 6
14 10
6 9
11 14
7 10
13 15
7 9
14 7
8 1
10 3
11 6
15 7
12 8
3 13
6 2
6 7
13 5
7 3
11 8
3 5
2 5
15 2
7 12
1 14
11 1
1 10
10 4
4 14
2 9
12 5
15 8
8 5
1 13
1 12
9 14
14 2
1 3
14 5
10 15
3 15
1 7
1 5
6 15
8 9
2 7...

output:

1

result:

ok 1 number(s): "1"

Test #6:

score: 0
Accepted
time: 198ms
memory: 213580kb

input:

15 45
13 15
3 15
5 4
15 14
6 10
2 3
10 11
9 8
8 7
10 4
9 2
3 8
15 2
2 6
15 9
6 15
10 7
8 2
5 6
14 10
12 10
8 1
11 3
3 12
2 1
11 15
11 5
2 7
1 11
8 4
1 6
14 5
5 2
13 1
7 11
4 12
12 14
15 5
7 5
10 2
4 7
13 2
4 14
12 1
12 11

output:

0

result:

ok 1 number(s): "0"

Test #7:

score: 0
Accepted
time: 220ms
memory: 213568kb

input:

15 48
5 14
11 1
6 8
10 3
10 6
3 4
3 8
15 3
10 15
2 11
5 15
7 10
7 14
5 10
2 9
9 3
11 4
11 7
12 5
9 10
10 14
10 2
13 11
2 8
10 13
2 3
7 12
13 3
10 8
12 10
15 12
4 7
9 13
7 13
5 7
2 13
11 14
9 15
6 15
8 12
2 6
1 13
3 14
4 15
5 3
6 3
4 10
2 7

output:

0

result:

ok 1 number(s): "0"

Test #8:

score: 0
Accepted
time: 211ms
memory: 213628kb

input:

15 104
9 1
11 4
11 6
2 14
8 3
10 6
1 4
8 5
4 15
10 4
12 4
14 11
7 9
12 15
1 10
13 14
9 14
1 6
4 2
2 9
5 10
14 10
2 10
12 6
3 10
9 5
1 7
12 14
5 2
10 13
7 6
6 8
10 15
8 14
14 5
9 12
1 3
12 10
10 9
6 14
8 7
8 11
10 11
13 6
11 5
12 3
3 13
11 9
7 12
8 1
11 12
15 8
8 12
9 13
8 9
14 7
7 11
3 7
3 11
14 3
1...

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 0
Accepted
time: 202ms
memory: 213568kb

input:

15 102
9 8
7 5
2 3
5 14
15 7
7 9
15 11
14 15
13 7
4 1
3 6
8 14
4 7
12 7
10 1
13 5
2 8
8 12
10 9
5 3
14 1
10 8
10 14
13 3
6 9
6 12
1 3
10 5
2 15
8 13
8 4
1 7
6 13
5 2
14 9
6 2
6 11
2 1
11 9
1 12
6 14
14 13
10 7
1 6
3 7
12 10
12 13
12 5
12 2
12 14
4 9
3 9
13 11
11 10
5 1
10 15
8 7
6 7
13 2
6 5
8 6
11 ...

output:

0

result:

ok 1 number(s): "0"

Test #10:

score: 0
Accepted
time: 214ms
memory: 213572kb

input:

15 104
3 4
11 8
5 13
8 7
9 4
7 11
3 2
6 11
10 4
9 7
3 12
11 2
1 11
5 12
1 10
5 6
6 7
2 10
12 14
1 14
13 11
1 3
9 8
6 13
10 14
1 7
11 10
11 14
6 8
11 9
12 13
15 7
9 3
13 4
3 14
12 7
2 4
10 9
10 7
2 1
15 9
6 15
12 9
14 7
7 3
12 15
11 3
3 10
4 6
5 11
10 5
11 15
13 10
6 1
10 12
12 11
4 7
10 8
4 1
13 2
3...

output:

0

result:

ok 1 number(s): "0"

Test #11:

score: 0
Accepted
time: 207ms
memory: 213496kb

input:

15 91
1 11
15 14
14 11
5 10
4 6
6 10
11 3
14 5
15 10
3 2
11 5
9 13
11 12
15 5
13 12
3 7
2 4
12 2
10 13
7 8
9 11
8 11
3 5
3 10
8 3
14 10
2 7
12 15
3 6
6 9
8 4
6 2
8 1
7 10
5 1
7 6
4 1
10 2
11 4
1 13
12 14
11 6
9 3
9 5
14 3
14 9
8 14
9 8
4 3
1 7
15 3
13 3
4 15
15 8
5 4
14 1
10 9
13 7
12 7
7 15
9 2
6 1...

output:

1

result:

ok 1 number(s): "1"

Test #12:

score: 0
Accepted
time: 201ms
memory: 213628kb

input:

15 103
13 9
2 6
13 1
7 6
1 3
3 7
1 14
9 3
4 5
14 8
14 13
10 9
13 4
12 10
14 15
1 4
11 10
8 7
7 11
6 9
14 6
10 5
1 8
11 8
7 2
5 6
5 3
2 10
1 11
3 4
7 13
14 3
4 10
12 5
9 12
5 1
1 6
12 2
2 11
9 1
1 7
8 9
10 15
3 2
7 10
2 9
12 7
2 4
1 12
2 5
2 14
3 10
4 14
10 6
14 10
11 4
14 11
15 11
2 8
11 6
15 6
15 7...

output:

1

result:

ok 1 number(s): "1"

Test #13:

score: 0
Accepted
time: 782ms
memory: 213580kb

input:

50 30
12 11
47 46
29 28
40 41
29 30
27 28
15 14
1 2
46 45
8 9
16 15
34 33
50 49
45 44
13 14
42 41
35 34
20 19
18 17
48 49
48 47
2 3
23 24
11 10
31 30
40 39
36 35
7 6
23 22
4 3

output:

1

result:

ok 1 number(s): "1"

Test #14:

score: 0
Accepted
time: 718ms
memory: 213508kb

input:

50 42
24 23
31 30
44 43
9 8
4 5
33 32
41 42
28 27
3 4
18 17
15 14
28 29
2 1
42 43
39 38
6 5
20 21
49 48
25 26
22 23
50 49
9 10
34 35
44 45
31 32
18 19
38 37
36 37
8 7
13 12
27 26
47 46
34 33
24 25
10 11
13 14
12 11
22 21
46 45
20 19
3 2
17 16

output:

1

result:

ok 1 number(s): "1"

Test #15:

score: 0
Accepted
time: 782ms
memory: 213624kb

input:

50 29
21 20
23 24
21 22
5 4
25 24
28 29
27 26
8 7
1 2
27 28
39 40
32 33
45 44
43 42
47 48
48 49
30 31
38 37
14 15
32 31
38 39
35 34
7 6
46 45
15 16
9 10
36 35
13 12
16 17

output:

1

result:

ok 1 number(s): "1"

Test #16:

score: 0
Accepted
time: 714ms
memory: 213568kb

input:

50 48
43 44
24 25
35 36
15 14
1 2
46 47
23 22
10 9
46 45
34 33
3 4
12 11
43 42
22 21
40 41
17 16
20 19
32 31
33 32
23 24
6 5
7 8
44 45
16 15
36 37
14 13
39 38
41 42
35 34
48 49
37 38
5 4
29 30
2 3
19 18
13 12
48 47
29 28
9 8
25 26
11 10
27 26
31 30
49 50
39 40
21 20
7 6
28 27

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 729ms
memory: 213628kb

input:

50 48
17 16
22 21
27 28
43 44
30 29
6 7
13 12
50 49
28 29
11 12
21 20
2 3
31 32
43 42
7 8
11 10
19 20
3 4
41 42
8 9
26 27
38 37
5 4
24 25
33 32
23 24
9 10
49 48
19 18
40 41
36 37
45 46
44 45
47 48
39 40
13 14
46 47
34 33
26 25
17 18
14 15
36 35
1 2
15 16
38 39
23 22
5 6
35 34

output:

1

result:

ok 1 number(s): "1"

Test #18:

score: 0
Accepted
time: 722ms
memory: 213512kb

input:

50 48
30 29
32 30
12 10
20 21
40 39
28 26
4 3
34 36
20 18
4 2
31 30
34 35
46 45
43 44
7 9
43 41
42 40
8 9
49 48
38 36
10 11
28 27
46 47
21 19
6 8
14 13
32 31
6 4
6 7
45 43
37 38
14 16
35 36
12 14
15 17
20 22
25 26
31 33
22 24
5 7
45 47
11 13
23 21
42 43
32 34
29 27
40 41
24 25

output:

0

result:

ok 1 number(s): "0"

Test #19:

score: 0
Accepted
time: 661ms
memory: 213580kb

input:

50 93
46 44
27 26
1 2
13 11
44 45
18 16
37 35
47 49
19 20
34 33
16 15
23 21
7 6
34 35
28 29
48 46
14 16
6 8
22 20
6 4
30 32
13 14
14 12
4 5
50 49
26 28
31 29
50 48
18 19
19 21
47 46
36 34
11 9
13 12
2 4
8 7
8 9
10 9
17 15
14 15
20 21
3 5
11 12
30 31
43 42
3 4
40 38
1 3
35 36
44 42
48 47
47 45
37 38
...

output:

0

result:

ok 1 number(s): "0"

Test #20:

score: 0
Accepted
time: 666ms
memory: 213632kb

input:

50 72
20 19
11 12
2 3
11 10
18 19
49 47
25 27
40 41
4 6
26 25
23 21
18 16
33 34
13 15
35 34
17 16
45 44
38 37
44 46
14 13
14 12
28 26
24 26
32 31
49 48
42 41
6 8
43 45
8 10
29 28
24 25
4 5
20 22
39 41
3 1
19 21
23 25
24 22
47 46
33 31
8 7
38 36
37 39
16 15
36 37
12 13
42 43
32 30
35 33
32 34
41 43
4...

output:

0

result:

ok 1 number(s): "0"

Test #21:

score: 0
Accepted
time: 656ms
memory: 213580kb

input:

50 84
16 15
12 14
35 37
24 22
44 42
17 19
30 32
36 38
24 23
36 37
34 36
21 23
33 34
19 20
45 46
22 20
10 12
42 41
25 27
26 27
34 32
15 13
26 25
21 22
7 6
28 30
40 38
1 3
47 49
39 37
29 31
13 14
28 29
35 34
8 6
44 46
30 29
44 45
48 46
33 35
49 50
36 35
11 12
21 19
42 43
7 5
2 1
47 46
33 32
13 12
16 1...

output:

1

result:

ok 1 number(s): "1"

Test #22:

score: 0
Accepted
time: 649ms
memory: 213512kb

input:

50 92
16 14
20 18
5 4
43 41
36 37
42 40
17 15
13 11
45 47
19 21
23 25
3 2
23 21
14 15
33 34
50 49
21 22
37 39
27 29
40 39
4 3
31 32
1 2
25 24
8 9
50 48
32 30
39 41
33 35
48 49
27 25
26 25
3 1
34 36
45 43
12 10
26 28
22 24
45 46
29 30
10 9
7 5
31 33
46 48
18 16
9 11
42 43
30 28
33 32
45 44
22 23
19 1...

output:

1

result:

ok 1 number(s): "1"

Test #23:

score: 0
Accepted
time: 673ms
memory: 213564kb

input:

50 128
32 29
19 18
41 43
41 38
21 19
24 22
47 46
37 38
30 27
39 36
17 18
30 33
13 12
44 47
42 45
13 14
26 25
18 20
45 43
3 6
6 4
28 27
15 16
37 35
42 43
42 39
18 16
37 36
37 40
12 14
13 16
35 34
32 31
8 5
38 39
17 19
32 34
2 5
35 32
9 8
26 27
34 36
16 17
12 11
34 31
2 3
25 22
39 40
7 8
34 37
2 4
50 ...

output:

0

result:

ok 1 number(s): "0"

Test #24:

score: 0
Accepted
time: 783ms
memory: 213580kb

input:

50 30
5 6
20 22
28 31
5 7
13 11
32 35
21 18
24 22
17 15
7 8
9 6
36 33
44 43
38 39
2 4
3 2
25 24
40 41
45 44
45 47
50 47
32 29
31 29
23 26
45 46
49 47
19 21
44 41
24 21
47 46

output:

1

result:

ok 1 number(s): "1"

Test #25:

score: 0
Accepted
time: 656ms
memory: 213584kb

input:

50 114
37 34
2 5
45 47
4 3
42 40
27 24
4 6
27 28
25 24
21 20
31 33
17 16
40 43
30 31
19 16
45 46
4 2
42 41
17 15
13 14
29 28
37 36
35 34
25 22
7 10
6 5
11 8
42 45
22 23
37 40
9 7
38 41
8 7
32 29
3 6
22 19
48 46
25 27
43 46
23 26
38 36
5 7
37 35
33 34
26 24
31 34
18 20
20 19
14 15
42 44
16 18
47 46
1...

output:

0

result:

ok 1 number(s): "0"

Test #26:

score: 0
Accepted
time: 668ms
memory: 213508kb

input:

50 103
5 6
24 25
49 48
8 5
46 44
12 14
5 3
20 19
2 3
17 14
24 22
10 12
25 22
19 18
6 9
26 28
20 17
13 12
40 39
40 38
32 31
36 39
1 3
4 6
42 39
26 25
5 7
35 37
39 41
4 7
31 30
27 30
16 15
11 8
47 45
3 4
35 32
41 40
23 25
24 26
13 10
44 47
42 41
34 35
7 9
8 7
31 34
17 15
35 38
14 16
18 16
16 13
13 15
...

output:

1

result:

ok 1 number(s): "1"

Test #27:

score: 0
Accepted
time: 650ms
memory: 213580kb

input:

50 133
18 15
13 16
44 42
35 32
36 34
48 49
17 18
1 4
7 8
3 6
49 47
33 35
22 24
34 35
46 43
27 26
14 12
4 6
42 43
11 14
31 28
40 42
20 18
27 30
30 31
3 5
35 36
18 21
21 24
32 31
40 37
38 35
19 18
22 23
20 22
24 26
40 39
3 4
20 17
4 5
42 45
11 9
4 2
9 10
32 30
11 8
9 12
43 41
38 37
20 23
5 6
46 44
13 ...

output:

0

result:

ok 1 number(s): "0"

Test #28:

score: 0
Accepted
time: 674ms
memory: 213568kb

input:

50 140
43 40
31 30
45 43
27 29
39 36
28 29
26 23
10 8
24 21
3 7
39 35
47 45
33 35
46 49
46 48
20 24
28 24
27 23
9 8
31 28
36 35
6 2
23 20
30 33
38 42
13 16
44 41
29 32
3 1
8 12
5 7
12 10
7 10
45 49
14 13
30 32
14 10
47 50
24 25
5 2
45 46
36 40
27 28
9 11
15 11
31 35
44 42
34 36
5 3
6 5
42 45
31 34
9...

output:

1

result:

ok 1 number(s): "1"

Test #29:

score: 0
Accepted
time: 672ms
memory: 213624kb

input:

50 128
3 4
15 14
22 18
33 29
23 24
13 11
45 48
17 20
24 27
21 24
46 44
26 28
8 9
42 39
26 23
43 40
5 7
36 38
36 39
21 17
37 33
28 25
21 19
41 44
27 28
32 31
18 20
36 37
34 35
39 41
5 1
16 14
26 27
11 15
29 28
42 46
12 11
47 44
31 29
48 49
45 49
23 20
12 10
47 50
23 25
31 33
1 3
25 26
38 41
36 40
15 ...

output:

0

result:

ok 1 number(s): "0"

Test #30:

score: 0
Accepted
time: 678ms
memory: 213508kb

input:

50 119
8 7
38 34
10 11
9 10
1 4
28 25
13 11
20 16
50 47
15 12
43 46
25 27
20 21
19 18
5 4
17 15
46 50
2 6
4 6
45 48
44 41
36 38
25 26
23 26
7 5
5 6
10 6
24 23
37 33
22 19
28 27
36 39
10 13
41 45
42 46
13 9
43 42
34 32
16 15
30 31
33 34
8 10
14 15
21 17
32 33
41 37
50 48
6 9
42 38
30 33
32 31
13 15
5...

output:

1

result:

ok 1 number(s): "1"

Test #31:

score: 0
Accepted
time: 648ms
memory: 213580kb

input:

50 189
11 14
29 28
47 45
49 47
7 11
32 30
33 31
18 17
42 40
23 19
19 20
18 20
24 21
28 27
24 28
16 18
12 8
12 11
41 44
15 18
16 12
13 14
5 3
18 22
34 38
15 16
29 30
20 17
25 23
38 39
48 44
27 31
42 46
36 35
21 20
8 6
32 28
6 7
24 20
32 36
25 24
20 16
6 9
9 7
8 7
36 39
46 48
35 33
41 45
43 41
28 31
5...

output:

1

result:

ok 1 number(s): "1"

Test #32:

score: 0
Accepted
time: 636ms
memory: 213552kb

input:

50 185
12 14
38 40
2 3
15 12
20 24
17 13
22 18
41 42
18 17
1 3
4 6
24 21
20 16
9 10
7 11
41 44
38 41
19 22
7 9
37 38
8 6
24 22
45 44
29 31
48 49
34 33
37 41
10 8
20 17
15 16
14 13
46 42
32 35
39 35
18 21
29 27
47 44
21 22
26 25
47 43
36 33
39 41
11 15
24 25
31 34
11 8
34 38
49 50
33 37
31 33
45 47
1...

output:

0

result:

ok 1 number(s): "0"

Test #33:

score: 0
Accepted
time: 636ms
memory: 213500kb

input:

50 180
35 37
43 44
8 4
24 27
13 9
38 41
34 29
31 28
17 19
41 44
37 33
45 40
9 6
21 17
48 49
3 7
19 20
13 10
17 12
31 35
6 7
7 2
2 3
6 4
31 27
40 35
20 21
6 2
27 23
47 43
21 16
5 4
19 14
28 33
28 32
44 39
47 46
27 22
1 5
17 16
46 48
48 50
44 46
15 18
35 34
13 17
24 20
41 37
24 21
49 45
47 48
5 10
49 ...

output:

1

result:

ok 1 number(s): "1"

Test #34:

score: 0
Accepted
time: 699ms
memory: 213636kb

input:

50 92
39 42
23 27
44 47
12 10
43 45
33 35
46 48
7 11
16 19
15 18
5 6
28 27
35 39
26 21
50 48
44 42
33 38
38 41
3 4
40 37
6 4
23 21
28 24
30 25
7 5
20 22
3 2
43 46
36 37
41 40
34 30
30 27
9 10
34 29
29 26
20 17
6 10
14 16
23 26
6 1
38 39
39 36
8 11
38 37
12 11
9 6
25 27
49 48
17 22
37 39
15 14
22 23
...

output:

0

result:

ok 1 number(s): "0"

Test #35:

score: 0
Accepted
time: 648ms
memory: 213628kb

input:

50 222
46 41
44 41
23 19
21 18
19 15
9 11
11 10
36 41
15 11
39 42
23 25
4 1
17 21
40 45
32 33
33 31
24 29
22 23
17 16
32 30
18 17
45 41
12 15
24 27
21 24
26 24
29 27
42 45
6 11
25 24
29 25
18 15
4 3
38 33
47 49
8 5
49 46
21 25
30 25
32 35
45 47
14 13
47 50
19 17
19 16
11 7
38 37
9 4
45 44
35 39
31 3...

output:

0

result:

ok 1 number(s): "0"

Test #36:

score: 0
Accepted
time: 632ms
memory: 213512kb

input:

50 203
36 40
19 16
21 26
20 15
18 14
11 13
28 33
42 45
50 49
26 31
5 6
46 42
41 43
41 36
49 47
19 18
47 44
5 9
26 25
19 17
28 31
2 1
33 34
50 45
21 20
25 22
37 41
13 10
12 14
35 34
22 17
35 31
34 38
23 26
40 42
49 46
22 24
20 23
20 25
40 45
11 7
23 24
8 9
25 29
15 19
14 10
16 17
35 40
38 40
22 27
7 ...

output:

0

result:

ok 1 number(s): "0"

Test #37:

score: 0
Accepted
time: 622ms
memory: 213552kb

input:

50 203
18 16
45 50
28 24
4 3
28 29
13 18
16 12
25 20
29 30
36 39
44 39
31 28
28 23
40 38
28 26
21 18
40 45
13 15
15 18
49 46
36 41
48 47
16 20
42 47
37 40
24 25
8 10
7 8
3 7
6 5
44 41
48 44
30 34
45 43
16 15
12 17
30 26
19 16
31 36
10 15
42 40
9 10
39 38
49 50
24 27
34 31
34 33
8 5
6 1
35 34
25 27
7...

output:

1

result:

ok 1 number(s): "1"

Test #38:

score: 0
Accepted
time: 935ms
memory: 213564kb

input:

50 18
23 27
43 41
31 33
29 30
22 20
25 20
31 27
36 41
30 36
50 49
45 40
25 29
44 49
33 36
14 16
31 29
31 37
35 34

output:

0

result:

ok 1 number(s): "0"

Test #39:

score: 0
Accepted
time: 632ms
memory: 213628kb

input:

50 224
43 38
13 12
16 18
42 43
17 18
47 42
11 9
44 47
3 5
28 33
15 9
7 11
17 13
28 31
30 36
38 40
44 41
26 21
18 12
10 6
1 2
41 45
45 40
14 8
40 39
41 37
13 18
8 2
16 19
4 10
39 43
19 22
20 19
26 22
24 23
16 17
27 25
42 44
41 35
17 12
33 35
47 50
6 3
46 43
21 24
19 24
12 10
26 29
34 38
17 22
3 2
38 ...

output:

0

result:

ok 1 number(s): "0"

Test #40:

score: 0
Accepted
time: 638ms
memory: 213624kb

input:

50 243
20 22
29 24
30 32
46 50
26 27
10 8
27 29
42 44
36 32
17 15
11 6
33 28
24 21
40 42
17 11
43 49
14 13
22 23
36 41
47 49
19 25
30 36
15 10
25 30
17 20
8 2
31 34
41 46
39 38
19 16
35 39
26 31
25 24
47 46
16 22
40 38
10 14
15 14
21 20
15 16
42 41
3 1
12 6
46 42
17 16
23 27
46 43
7 12
30 34
14 20
4...

output:

1

result:

ok 1 number(s): "1"

Test #41:

score: 0
Accepted
time: 625ms
memory: 213584kb

input:

50 255
7 5
34 35
16 22
11 17
30 33
10 14
32 36
24 28
17 20
21 23
35 39
12 8
13 8
33 28
11 12
29 24
43 48
46 42
37 31
36 41
32 27
41 39
48 50
2 7
15 9
7 6
32 28
30 36
27 28
25 24
16 15
16 19
24 19
19 22
33 31
43 45
3 2
33 38
26 20
13 15
39 42
24 26
30 24
23 29
45 40
12 7
27 24
12 15
7 1
46 45
32 29
2...

output:

0

result:

ok 1 number(s): "0"

Test #42:

score: 0
Accepted
time: 615ms
memory: 213632kb

input:

50 279
39 37
45 40
17 14
13 14
28 30
31 25
8 5
43 40
43 37
13 8
15 19
36 39
45 43
45 46
24 18
40 39
21 25
23 19
19 17
40 46
39 42
36 41
47 48
10 15
19 13
41 46
50 49
45 41
36 40
7 4
36 42
37 38
27 26
30 27
37 40
28 31
17 23
37 41
42 48
48 44
33 37
28 22
26 25
29 33
32 27
3 5
27 33
41 39
25 20
20 23
...

output:

0

result:

ok 1 number(s): "0"

Test #43:

score: 0
Accepted
time: 650ms
memory: 213508kb

input:

50 219
27 26
43 38
35 32
26 32
29 25
44 45
44 41
46 44
7 14
45 50
13 10
20 21
34 30
10 16
22 24
21 15
11 13
47 49
48 47
23 21
19 20
18 11
14 16
2 1
49 42
50 49
6 4
19 23
27 28
12 17
41 36
24 21
24 31
33 26
47 41
29 33
6 12
12 9
26 21
49 44
39 38
13 6
28 29
11 12
29 23
18 13
17 13
31 36
10 4
45 41
24...

output:

0

result:

ok 1 number(s): "0"

Test #44:

score: 0
Accepted
time: 626ms
memory: 213504kb

input:

50 223
18 12
39 41
2 5
46 42
17 24
36 41
30 27
38 43
38 42
29 22
24 28
19 22
18 24
37 31
16 9
46 49
4 5
2 6
3 7
43 37
23 26
48 41
22 16
8 3
44 40
3 9
17 22
5 3
15 10
16 10
32 36
48 47
15 14
47 43
41 43
8 13
39 37
38 41
23 27
10 3
38 32
12 8
42 40
20 21
24 21
46 47
36 40
43 49
40 47
33 32
36 29
8 6
1...

output:

1

result:

ok 1 number(s): "1"

Test #45:

score: 0
Accepted
time: 625ms
memory: 213568kb

input:

50 177
6 5
31 32
19 12
27 33
22 18
30 27
43 41
44 42
32 26
38 41
9 7
17 15
40 36
28 26
37 39
6 10
6 7
30 25
20 17
27 21
25 19
2 7
40 43
20 14
39 34
14 16
2 3
40 38
38 35
24 31
19 24
45 50
3 7
29 28
46 42
50 46
48 50
26 25
29 33
9 12
32 28
48 49
11 9
9 13
48 44
25 31
1 3
46 44
5 4
36 31
21 19
42 37
7...

output:

1

result:

ok 1 number(s): "1"

Test #46:

score: 0
Accepted
time: 636ms
memory: 213584kb

input:

50 318
13 6
23 22
42 35
31 32
45 48
30 27
50 46
15 10
9 12
33 35
24 20
43 46
27 32
41 40
46 48
44 39
22 24
15 16
31 34
30 23
19 15
38 31
22 27
24 29
22 16
23 20
17 21
39 40
24 31
17 23
21 19
27 21
24 30
44 46
6 9
9 8
4 3
31 35
48 41
26 23
26 28
17 16
17 12
5 3
13 10
1 7
31 29
39 42
23 29
32 28
15 9
...

output:

0

result:

ok 1 number(s): "0"

Test #47:

score: 0
Accepted
time: 649ms
memory: 213564kb

input:

50 252
39 40
29 30
17 15
15 16
30 34
17 13
10 4
1 5
19 16
19 21
7 5
17 19
10 11
14 17
16 9
46 40
11 7
17 12
42 41
46 44
5 9
23 25
31 28
42 44
22 29
3 1
48 49
16 14
35 34
31 29
38 36
32 29
28 24
20 22
31 35
37 42
41 39
50 44
34 32
26 19
45 41
26 22
4 11
30 23
27 21
33 40
46 39
19 15
23 20
34 41
37 31...

output:

0

result:

ok 1 number(s): "0"

Test #48:

score: 0
Accepted
time: 656ms
memory: 213580kb

input:

50 131
35 39
34 37
31 29
10 5
12 16
16 15
24 27
34 42
7 5
30 29
16 18
49 45
30 27
15 7
18 26
38 32
36 42
27 20
4 8
35 40
30 22
7 2
2 9
1 6
35 33
4 3
24 32
40 32
38 30
6 4
31 34
32 33
31 32
12 19
26 24
23 15
13 7
20 25
23 20
39 44
10 7
48 49
43 41
14 21
16 24
26 23
25 23
35 36
28 34
25 26
31 26
21 28...

output:

0

result:

ok 1 number(s): "0"

Test #49:

score: 0
Accepted
time: 617ms
memory: 213632kb

input:

50 169
18 22
41 34
23 15
32 39
26 25
43 41
26 21
40 45
22 16
37 31
22 23
35 38
15 20
9 7
27 30
32 24
16 8
34 38
30 26
30 35
19 23
23 21
47 50
14 16
16 24
14 11
29 33
41 40
24 20
50 48
40 38
40 44
27 20
5 9
23 30
15 7
28 36
15 14
11 10
2 4
29 26
36 44
31 35
41 35
18 12
7 8
17 10
8 12
18 23
42 41
35 4...

output:

0

result:

ok 1 number(s): "0"

Test #50:

score: 0
Accepted
time: 626ms
memory: 213516kb

input:

50 312
15 16
48 41
23 17
44 40
24 16
13 19
45 44
22 17
42 45
15 10
29 28
39 41
28 33
29 35
42 49
15 18
12 6
34 32
28 25
42 40
29 22
19 26
38 30
44 39
3 11
7 9
35 32
21 20
27 22
18 26
8 3
36 44
40 43
33 39
13 11
1 8
4 12
34 26
30 34
49 44
43 49
5 7
30 32
16 13
24 23
16 21
36 32
38 44
20 27
18 13
8 16...

output:

0

result:

ok 1 number(s): "0"

Test #51:

score: 0
Accepted
time: 645ms
memory: 213628kb

input:

50 324
47 43
37 44
24 22
35 43
3 10
38 39
35 28
17 18
24 21
33 29
3 9
20 22
38 44
22 23
10 13
23 25
29 37
26 34
14 16
7 13
12 17
37 36
19 17
47 48
2 4
14 11
40 34
36 40
1 5
16 9
4 3
38 36
46 45
23 16
17 23
13 9
40 33
18 26
5 9
35 29
16 20
45 44
31 26
43 50
46 44
24 20
31 37
49 47
7 3
48 46
20 25
45 ...

output:

1

result:

ok 1 number(s): "1"

Test #52:

score: 0
Accepted
time: 608ms
memory: 213628kb

input:

50 362
19 11
48 46
8 10
32 40
36 38
21 24
3 11
19 18
19 24
29 33
10 6
45 50
10 5
8 2
22 30
38 30
9 12
17 23
14 18
31 34
12 18
28 34
6 5
29 21
38 43
32 29
11 14
12 5
22 19
26 21
7 15
1 8
7 8
40 46
31 27
21 17
22 14
36 30
15 11
36 42
9 4
31 28
4 7
2 7
47 48
24 32
26 27
30 28
31 35
39 31
48 42
37 35
34...

output:

1

result:

ok 1 number(s): "1"

Test #53:

score: 0
Accepted
time: 541ms
memory: 213512kb

input:

50 215
34 32
35 41
16 23
44 36
31 30
28 35
7 14
23 26
30 26
7 12
17 12
48 46
14 19
46 43
4 13
18 14
16 12
7 3
36 29
47 40
34 30
21 23
12 21
42 46
8 9
27 36
49 50
13 22
36 37
9 2
15 20
43 40
41 43
37 40
36 31
47 49
18 23
43 38
39 37
11 9
1 7
45 42
31 33
19 18
3 9
31 38
15 24
25 30
39 30
25 22
18 16
1...

output:

0

result:

ok 1 number(s): "0"

Test #54:

score: 0
Accepted
time: 587ms
memory: 213568kb

input:

50 158
22 14
34 25
12 18
19 22
4 13
33 30
36 32
15 13
34 31
26 24
13 7
27 19
18 24
12 20
26 31
18 10
47 41
27 26
8 14
8 1
17 12
33 31
8 5
21 16
17 16
18 23
16 10
11 10
39 46
39 43
27 32
1 9
13 9
24 30
38 40
14 7
15 16
44 47
37 42
9 18
14 18
9 17
5 3
27 30
50 43
16 23
29 32
35 42
33 34
49 45
29 25
39...

output:

1

result:

ok 1 number(s): "1"

Test #55:

score: 0
Accepted
time: 584ms
memory: 213568kb

input:

50 342
11 17
33 31
28 34
7 14
33 28
10 11
12 13
28 37
16 18
5 10
22 17
21 28
21 27
23 30
11 14
46 47
19 15
45 40
43 37
10 7
5 8
15 7
6 13
35 41
14 17
35 26
43 48
45 38
44 42
23 29
33 32
27 30
22 31
23 20
36 45
31 35
7 5
7 8
11 12
26 31
13 8
29 30
16 20
4 8
3 12
24 15
17 16
7 2
29 27
23 16
39 44
18 2...

output:

1

result:

ok 1 number(s): "1"

Test #56:

score: 0
Accepted
time: 576ms
memory: 213572kb

input:

50 285
9 8
28 26
22 30
47 44
44 48
48 40
9 2
36 32
27 33
9 5
16 11
8 4
23 27
25 29
22 31
40 46
2 1
18 15
46 42
6 2
34 42
28 31
25 33
11 3
34 43
15 24
22 13
7 6
34 31
46 47
28 37
44 37
45 44
47 43
41 48
50 47
20 11
11 5
23 17
25 32
21 18
24 16
31 35
9 12
31 27
38 30
38 46
11 12
3 2
13 7
35 44
21 25
2...

output:

1

result:

ok 1 number(s): "1"

Test #57:

score: 0
Accepted
time: 567ms
memory: 213492kb

input:

50 382
21 29
31 30
37 41
24 21
45 39
34 26
9 2
40 44
16 21
3 10
21 30
49 43
27 22
29 24
36 27
32 30
47 42
5 4
1 5
13 8
44 50
39 32
47 38
27 23
41 34
44 43
40 48
41 39
13 11
20 24
6 14
17 11
34 37
21 15
15 9
16 20
21 19
37 38
5 11
7 16
10 11
50 48
1 10
26 25
25 28
41 35
20 13
28 22
20 22
7 4
8 3
1 8
...

output:

1

result:

ok 1 number(s): "1"

Test #58:

score: 0
Accepted
time: 603ms
memory: 213632kb

input:

50 267
40 31
32 35
42 34
36 27
42 40
26 23
32 41
13 5
40 39
12 22
30 37
27 17
21 12
20 18
36 31
8 16
34 44
10 15
34 38
14 7
45 35
7 1
34 39
31 39
28 36
11 13
1 11
28 22
30 34
13 4
25 20
12 18
32 42
1 9
28 34
21 17
23 14
30 27
35 29
44 41
20 11
25 32
25 22
22 29
19 20
25 26
41 45
48 45
17 7
17 20
24 ...

output:

1

result:

ok 1 number(s): "1"

Test #59:

score: 0
Accepted
time: 556ms
memory: 213512kb

input:

50 343
40 49
18 11
10 18
14 8
25 19
24 27
31 21
47 48
11 10
22 26
28 32
40 30
9 13
20 22
6 11
29 26
15 21
31 26
11 19
29 28
12 19
29 23
16 13
7 11
8 17
3 10
12 14
30 39
15 20
36 41
10 4
38 30
22 30
23 14
49 46
9 19
3 1
14 7
43 39
25 31
45 50
21 11
39 48
12 3
16 7
29 19
25 27
44 48
33 41
28 19
9 15
3...

output:

1

result:

ok 1 number(s): "1"

Test #60:

score: 0
Accepted
time: 539ms
memory: 213504kb

input:

50 419
24 34
45 47
39 33
9 3
33 30
22 26
33 23
46 49
15 24
12 3
26 24
46 40
34 33
5 4
29 21
18 24
6 15
42 32
18 12
18 8
37 32
1 11
23 32
20 21
13 18
35 31
25 32
28 38
11 8
44 38
30 24
47 38
48 43
17 25
5 1
2 5
10 6
33 29
45 38
27 24
34 41
40 49
18 11
20 17
16 18
5 14
29 31
16 10
16 21
23 24
40 45
40...

output:

0

result:

ok 1 number(s): "0"

Test #61:

score: 0
Accepted
time: 552ms
memory: 213504kb

input:

50 295
32 36
43 50
3 7
3 12
5 8
11 14
44 48
1 9
3 6
20 25
35 31
11 12
20 21
5 1
26 30
19 16
35 37
34 42
16 23
29 31
18 17
28 21
50 45
4 11
10 7
41 47
43 35
25 30
34 41
11 13
35 40
36 41
32 40
15 7
40 37
41 35
20 11
10 18
44 42
24 32
17 9
43 49
25 35
47 45
11 18
43 47
22 30
43 34
21 18
6 14
43 45
31 ...

output:

0

result:

ok 1 number(s): "0"

Test #62:

score: 0
Accepted
time: 602ms
memory: 213516kb

input:

50 364
27 22
34 28
32 42
47 48
24 31
15 22
44 42
27 31
25 24
31 36
4 13
15 25
34 39
32 40
33 36
46 41
35 25
34 41
25 23
21 30
9 10
10 8
14 23
33 39
31 33
39 46
6 14
7 5
10 15
35 26
17 25
26 29
8 6
9 2
14 9
15 8
30 32
1 8
20 17
5 10
35 40
6 13
26 19
40 42
40 46
3 11
15 11
49 44
38 46
27 28
28 33
40 3...

output:

0

result:

ok 1 number(s): "0"

Test #63:

score: 0
Accepted
time: 598ms
memory: 213500kb

input:

50 57
27 25
43 34
8 13
15 4
22 28
40 29
26 23
18 26
2 11
2 9
3 10
25 26
35 44
22 19
30 28
40 37
15 18
14 24
39 46
9 3
34 30
41 30
13 15
5 12
37 36
17 22
46 44
14 15
14 19
33 31
24 25
6 15
6 10
22 25
1 5
21 26
13 10
37 48
24 21
35 39
50 45
38 46
37 45
12 23
30 22
19 26
26 32
20 27
32 40
19 10
50 43
1...

output:

1

result:

ok 1 number(s): "1"

Test #64:

score: 0
Accepted
time: 628ms
memory: 213564kb

input:

50 412
30 22
7 8
42 35
44 41
13 15
21 14
31 21
49 46
33 38
27 30
17 19
43 42
19 10
26 21
25 20
26 27
34 24
15 9
39 41
39 50
38 47
11 1
13 12
17 13
18 14
32 30
22 24
17 22
28 29
27 29
18 29
33 31
35 37
46 43
2 7
7 15
31 35
10 21
11 21
22 33
19 12
34 42
16 25
12 20
31 42
21 28
6 13
41 40
37 41
8 15
17...

output:

1

result:

ok 1 number(s): "1"

Test #65:

score: 0
Accepted
time: 573ms
memory: 213508kb

input:

50 155
17 14
25 19
43 40
11 8
36 37
20 10
27 33
49 43
32 37
34 41
7 3
22 30
21 23
33 38
37 35
21 16
16 24
41 49
29 33
29 27
12 19
20 26
13 24
40 31
12 14
1 5
14 15
37 46
25 31
15 16
14 25
23 25
21 31
46 48
38 32
15 18
45 42
15 13
29 35
36 28
14 9
9 16
37 28
21 19
11 10
22 29
35 44
41 42
10 17
28 26
...

output:

0

result:

ok 1 number(s): "0"

Test #66:

score: 0
Accepted
time: 572ms
memory: 213508kb

input:

50 359
17 18
20 14
37 28
8 9
24 28
35 43
44 43
33 37
17 28
37 44
24 15
13 18
28 38
41 36
2 9
33 23
42 39
5 6
15 22
46 36
16 14
42 33
15 23
22 30
39 28
27 30
24 20
2 10
28 21
16 22
26 20
45 38
37 43
29 25
15 14
29 30
32 23
35 33
27 38
27 24
40 34
18 28
13 14
10 14
47 43
13 21
24 14
41 33
15 8
50 42
3...

output:

1

result:

ok 1 number(s): "1"

Test #67:

score: 0
Accepted
time: 584ms
memory: 213632kb

input:

50 154
17 19
13 7
27 37
32 29
27 28
18 11
22 13
15 24
42 48
34 23
36 39
3 6
34 40
22 12
46 45
48 49
12 23
18 8
9 10
36 25
21 24
39 44
22 33
30 35
14 17
4 13
41 39
50 45
33 41
17 25
37 29
2 10
24 30
21 32
30 22
24 31
14 23
2 11
37 36
31 22
29 33
15 14
17 16
33 27
32 27
21 11
47 44
26 16
7 17
24 13
4 ...

output:

0

result:

ok 1 number(s): "0"

Test #68:

score: -100
Time Limit Exceeded

input:

50 4
42 32
11 5
27 35
46 40

output:

0

result: