QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#90882#42. Alternating CurrentHe_Ren100 ✓95ms13272kbC++233.4kb2023-03-26 02:15:502023-03-26 02:17:05

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-26 02:17:05]
  • 评测
  • 测评结果:100
  • 用时:95ms
  • 内存:13272kb
  • [2023-03-26 02:15:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MAXN = 1e5 + 5;
const int MAXM = 1e5 + 5;

struct Segment_Tree {
    int mn[MAXN << 2], tag[MAXN << 2];
#define ls(u) ((u)<<1)
#define rs(u) ((u)<<1|1)
#define lson(u) ls(u),l,mid
#define rson(u) rs(u),mid+1,r
    inline void upd(int u, int k) {
        mn[u] += k;
        tag[u] += k;
    }
    inline void push_up(int u) {
        mn[u] = min(mn[ls(u)], mn[rs(u)]);
    }
    inline void push_down(int u) {
        if (tag[u]) {
            upd(ls(u), tag[u]);
            upd(rs(u), tag[u]);
            tag[u] = 0;
        }
    }
    void add(int u, int l, int r, int ql, int qr, int k) {
        if (ql <= l && r <= qr) {
            upd(u, k);
            return;
        }

        push_down(u);
        int mid = (l + r) >> 1;

        if (ql <= mid)
            add(lson(u), ql, qr, k);

        if (mid < qr)
            add(rson(u), ql, qr, k);

        push_up(u);
    }
} tree[2];

int n, m;
array<int, 3> p[MAXN];

int res[MAXN];
void addtree(int t, int i, int k) {
    if (p[i][1] <= n)
        tree[t].add(1, 1, n, p[i][0], p[i][1], k);
    else
        tree[t].add(1, 1, n, 1, p[i][1] - n, k), tree[t].add(1, 1, n, p[i][0], n, k);
}
void change(int u, int k) {
    if (res[u] == k)
        return;

    res[u] = k;
    addtree(k, u, 1);
    addtree(k ^ 1, u, -1);
}
bool isvalid(void) {
    return tree[0].mn[1] > 0 && tree[1].mn[1] > 0;
}
void printans(void) {
    static char fin[MAXN];

    for (int i = 1; i <= m; ++i)
        fin[p[i][2]] = res[i] + '0';

    printf("%s\n", fin + 1);
    exit(0);
}

int main(void) {
    scanf("%d%d", &n, &m);

    for (int i = 1; i <= m; ++i) {
        int l, r;
        scanf("%d%d", &l, &r);

        if (l <= r)
            p[i] = {l, r, i};
        else
            p[i] = {l, r + n, i};
    }

    sort(p + 1, p + m + 1);

    for (int i = 1; i <= m; ++i)
        addtree(0, i, 1);

    for (int i = 1; i <= m; ++i) {
        if (p[i][1] - p[i][0] + 1 == n) {
            change(i, 1);

            if (isvalid()) {
                printans();
                return 0;
            }

            printf("impossible\n");
            return 0;
        }
    }

    static int sta[MAXN], anc[MAXN];
    int hd = 1, tl = 0;

    for (int i = 1; i <= m; ++i) {
        if (tl && p[i][1] <= p[sta[tl]][1])
            anc[i] = sta[tl];
        else
            sta[++tl] = i;
    }

    while (tl - hd + 1 >= 2 && p[sta[tl]][1] - n >= p[sta[hd]][1]) {
        anc[sta[hd]] = sta[tl];
        ++hd;
    }

    static vector<int> g[MAXN];

    for (int i = 1; i <= m; ++i)
        if (anc[i])
            g[anc[i]].emplace_back(i);

    for (int i = hd; i <= tl; ++i) {
        change(sta[i], i & 1);

        for (int j : g[sta[i]])
            change(j, !(i & 1));
    }

    if (isvalid()) {
        printans();
        return 0;
    }

    if ((tl + hd + 1) % 2 == 0) {
        printf("impossible\n");
        return 0;
    }

    for (int i = hd; i <= tl; ++i) {
        change(sta[i], res[sta[i]] ^ 1);

        for (int j : g[sta[i]])
            change(j, res[j] ^ 1);

        if (isvalid()) {
            printans();
            return 0;
        }
    }

    printf("impossible\n");
    return 0;
}

詳細信息

Subtask #1:

score: 13
Accepted

Test #1:

score: 13
Accepted
time: 2ms
memory: 3708kb

input:

15 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15

output:

100000000000000

result:

ok 

Test #2:

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

input:

15 2
1 15
1 15

output:

10

result:

ok 

Test #3:

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

input:

15 5
13 6
12 13
7 12
14 10
1 11

output:

01011

result:

ok 

Test #4:

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

input:

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

output:

111100010

result:

ok 

Test #5:

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

input:

15 7
5 7
3 5
9 2
4 5
8 11
10 3
6 9

output:

0110001

result:

ok 

Test #6:

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

input:

15 8
3 3
14 6
5 8
8 8
9 13
13 3
7 12
4 7

output:

01111000

result:

ok 

Test #7:

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

input:

14 4
4 3
3 3
7 6
1 14

output:

0001

result:

ok 

Test #8:

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

input:

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

output:

impossible

result:

ok 

Test #9:

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

input:

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

output:

1000000000

result:

ok 

Test #10:

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

input:

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

output:

impossible

result:

ok 

Test #11:

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

input:

15 7
12 1
12 13
3 3
13 13
1 1
4 12
14 12

output:

impossible

result:

ok 

Test #12:

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

input:

15 10
5 8
14 9
12 2
8 9
10 10
15 1
11 12
12 13
10 12
2 5

output:

1011010011

result:

ok 

Test #13:

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

input:

15 11
14 15
9 14
10 10
4 7
1 3
11 12
1 4
4 4
3 3
4 10
13 14

output:

impossible

result:

ok 

Test #14:

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

input:

15 6
8 2
15 15
1 8
4 7
2 3
8 15

output:

100110

result:

ok 

Test #15:

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

input:

11 7
10 4
5 9
1 2
11 1
10 10
2 6
7 9

output:

1100000

result:

ok 

Test #16:

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

input:

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

output:

000000000000100

result:

ok 

Test #17:

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

input:

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

output:

0011100001

result:

ok 

Test #18:

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

input:

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

output:

1000011110

result:

ok 

Test #19:

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

input:

15 6
4 12
2 3
12 5
12 7
5 12
12 12

output:

011011

result:

ok 

Test #20:

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

input:

15 6
1 3
15 15
2 15
1 11
14 14
12 15

output:

101000

result:

ok 

Test #21:

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

input:

6 3
6 6
4 3
1 5

output:

010

result:

ok 

Test #22:

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

input:

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

output:

100000010010010

result:

ok 

Test #23:

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

input:

14 2
6 5
11 10

output:

10

result:

ok 

Test #24:

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

input:

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

output:

000000001000000

result:

ok 

Test #25:

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

input:

14 9
7 10
12 14
10 14
3 9
3 3
11 11
1 2
4 6
1 2

output:

001100100

result:

ok 

Test #26:

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

input:

15 8
14 8
10 12
10 10
9 9
13 9
11 11
12 12
13 13

output:

01001000

result:

ok 

Test #27:

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

input:

15 12
5 7
7 14
14 14
7 7
7 7
6 6
4 4
5 5
2 3
1 4
1 1
8 13

output:

impossible

result:

ok 

Test #28:

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

input:

15 6
5 6
2 2
5 6
1 1
3 15
2 1

output:

000001

result:

ok 

Test #29:

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

input:

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

output:

impossible

result:

ok 

Test #30:

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

input:

13 6
9 2
1 5
1 10
12 5
8 10
8 8

output:

impossible

result:

ok 

Test #31:

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

input:

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

output:

000000000010000

result:

ok 

Test #32:

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

input:

13 5
7 13
11 4
5 8
7 7
5 13

output:

impossible

result:

ok 

Test #33:

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

input:

13 8
8 2
9 8
1 12
2 13
9 4
13 11
8 3
11 7

output:

01000000

result:

ok 

Test #34:

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

input:

15 2
11 13
3 13

output:

impossible

result:

ok 

Test #35:

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

input:

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

output:

impossible

result:

ok 

Test #36:

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

input:

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

output:

101010010000011

result:

ok 

Test #37:

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

input:

12 15
6 6
2 4
8 11
7 8
8 12
5 7
3 4
12 2
10 2
3 7
5 6
6 7
8 9
9 11
11 3

output:

111101011011010

result:

ok 

Test #38:

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

input:

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

output:

impossible

result:

ok 

Test #39:

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

input:

7 15
1 1
2 2
3 3
4 4
5 5
6 6
7 7
1 1
2 2
3 3
4 4
5 5
6 6
7 7
1 1

output:

101010101010100

result:

ok 

Test #40:

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

input:

6 12
1 1
2 2
3 3
4 4
5 5
6 6
1 1
2 2
3 3
4 4
5 5
6 6

output:

101010010101

result:

ok 

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #41:

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

input:

100 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 10...

output:

1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok 

Test #42:

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

input:

100 11
98 19
34 71
22 26
7 21
80 6
72 79
42 72
25 41
20 24
73 97
27 70

output:

10000011110

result:

ok 

Test #43:

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

input:

100 99
77 78
71 72
30 31
32 33
15 16
35 36
37 38
75 76
90 91
46 47
14 15
64 65
27 28
43 44
67 68
76 77
8 9
5 6
87 88
7 8
91 92
2 4
89 90
96 97
25 26
4 5
82 83
42 43
61 62
72 73
51 52
21 22
13 14
99 1
44 45
36 37
20 21
86 87
58 59
6 7
55 56
34 35
100 2
9 10
57 58
52 53
48 49
83 84
39 40
78 79
70 71
2...

output:

001100001111000110000001011101000011111101100110011101011111001111100111001110110000001100000011001

result:

ok 

Test #44:

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

input:

100 7
94 30
23 74
99 55
30 70
70 95
69 79
74 3

output:

1100100

result:

ok 

Test #45:

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

input:

100 16
17 46
47 61
83 83
65 80
61 65
41 52
16 30
43 43
11 17
63 76
76 11
67 69
81 16
53 62
30 52
51 51

output:

1101110100001000

result:

ok 

Test #46:

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

input:

100 100
59 60
92 93
43 44
54 55
65 66
96 97
7 8
27 28
83 85
61 62
38 39
87 88
57 58
34 35
22 23
31 32
90 92
19 19
76 77
33 34
15 16
5 6
98 99
69 70
10 11
55 56
82 84
19 20
49 50
20 21
78 79
70 71
95 96
75 76
77 78
46 47
58 59
23 24
85 86
9 10
63 64
60 61
14 15
73 74
12 13
94 95
99 100
45 46
28 29
86...

output:

1010101111001001110111010101100011100101100100110111000001100100000011110000101000111010110101110001

result:

ok 

Test #47:

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

input:

20 5
9 18
19 8
5 9
10 20
13 4

output:

11000

result:

ok 

Test #48:

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

input:

99 49
1 99
2 98
3 97
4 96
5 95
6 94
7 93
8 92
9 91
10 90
11 89
12 88
13 87
14 86
15 85
16 84
17 83
18 82
19 81
20 80
21 79
22 78
23 77
24 76
25 75
26 74
27 73
28 72
29 71
30 70
31 69
32 68
33 67
34 66
35 65
36 64
37 63
38 62
39 61
40 60
41 59
42 58
43 57
44 56
45 55
46 54
47 53
48 52
49 51

output:

impossible

result:

ok 

Test #49:

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

input:

98 51
1 98
2 97
3 96
4 95
5 94
6 93
7 92
8 91
9 90
10 89
11 88
12 87
13 86
14 85
15 84
16 83
17 82
18 81
19 80
20 79
21 78
22 77
23 76
24 75
25 74
26 73
27 72
28 71
29 70
30 69
31 68
32 67
33 66
34 65
35 64
36 63
37 62
38 61
39 60
40 59
41 58
42 57
43 56
44 55
45 54
46 53
47 52
48 51
49 50
1 1
98 98

output:

100000000000000000000000000000000000000000000000000

result:

ok 

Test #50:

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

input:

100 14
83 86
100 1
54 68
2 11
66 79
12 65
96 99
81 81
18 53
82 11
12 17
69 76
77 82
87 95

output:

impossible

result:

ok 

Test #51:

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

input:

100 23
10 48
33 33
91 1
86 10
43 56
15 31
82 85
6 13
77 81
68 68
55 65
69 83
58 61
49 57
64 69
73 77
84 85
100 5
61 68
32 33
69 73
83 92
34 43

output:

impossible

result:

ok 

Test #52:

score: 0
Accepted
time: 6ms
memory: 5824kb

input:

100 100
42 42
10 19
40 40
38 47
77 77
38 39
90 90
31 38
22 31
52 52
57 57
52 52
34 34
69 69
95 95
96 96
70 70
38 38
79 82
11 11
38 38
51 52
45 45
64 64
91 91
39 47
26 26
94 94
70 70
84 84
72 76
53 53
26 26
45 45
34 34
60 60
33 36
54 57
30 30
100 100
56 56
33 33
82 85
77 81
74 74
72 78
100 100
58 58
...

output:

impossible

result:

ok 

Test #53:

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

input:

100 84
62 64
36 42
43 44
96 97
98 98
73 75
22 22
78 82
17 20
33 34
38 41
32 32
59 59
18 18
68 69
28 31
76 78
25 25
21 21
11 11
89 89
4 4
7 11
26 26
45 47
55 55
34 37
65 65
23 23
52 58
45 50
6 6
79 79
14 16
9 10
14 17
24 24
80 86
5 5
66 68
27 27
13 13
1 1
19 20
8 8
62 62
42 42
61 61
69 74
12 13
100 1...

output:

impossible

result:

ok 

Test #54:

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

input:

100 26
31 36
61 65
86 91
30 30
20 27
100 4
43 47
21 25
59 60
79 6
47 59
59 79
26 58
98 100
91 95
15 19
65 70
28 30
7 20
97 97
95 97
36 43
14 14
5 14
19 20
70 85

output:

10011010011100000110010000

result:

ok 

Test #55:

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

input:

100 8
34 62
9 18
81 8
32 37
34 96
63 84
19 34
95 37

output:

00001001

result:

ok 

Test #56:

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

input:

100 100
73 73
65 65
62 65
99 6
96 97
59 59
28 28
28 28
98 100
54 54
55 58
81 85
8 8
42 46
47 48
12 12
84 84
24 26
66 66
33 34
43 43
34 34
50 58
79 80
13 27
49 49
14 14
16 16
95 95
93 93
83 83
17 17
46 46
18 18
77 77
94 94
58 58
86 86
53 53
66 69
70 78
52 52
12 12
64 65
36 38
88 88
7 7
40 40
94 94
54...

output:

1101001000000110011000100111000101100000000110100011001010000011000110010001010110100011100010001000

result:

ok 

Test #57:

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

input:

100 12
29 44
6 12
23 60
76 28
16 22
61 15
90 95
5 7
45 75
89 95
55 55
89 95

output:

100100001000

result:

ok 

Test #58:

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

input:

100 100
22 23
21 21
88 88
99 99
57 57
16 17
67 68
15 15
18 19
94 94
61 61
40 41
1 1
59 59
51 51
86 87
84 86
64 66
10 13
8 8
2 6
61 62
53 54
58 59
14 14
71 74
96 97
32 36
100 100
27 28
98 98
60 60
88 89
68 68
60 60
89 90
36 37
81 83
38 39
17 17
90 90
96 97
54 55
25 26
37 40
56 56
20 20
84 85
93 93
24...

output:

1101111100111011011010011000101010101010111001110111101001000010100101000010101010000100011110110010

result:

ok 

Test #59:

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

input:

100 4
73 100
70 22
23 69
1 72

output:

1001

result:

ok 

Test #60:

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

input:

97 13
92 35
87 89
51 60
36 91
61 67
85 86
68 84
32 33
15 19
20 29
30 31
34 50
90 14

output:

0110111111111

result:

ok 

Test #61:

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

input:

100 16
26 29
58 25
25 25
40 40
58 58
59 24
40 40
32 39
25 25
40 58
25 30
31 31
41 57
30 30
58 58
31 40

output:

1011011101010100

result:

ok 

Test #62:

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

input:

100 21
7 30
1 6
31 54
58 58
55 57
55 55
100 7
30 30
31 31
6 6
60 1
60 60
54 54
61 100
54 58
1 1
42 42
100 100
7 7
6 31
30 55

output:

impossible

result:

ok 

Test #63:

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

input:

100 48
1 49
1 50
3 51
4 52
5 53
6 54
7 55
8 56
9 57
10 58
11 59
12 60
13 61
14 62
15 63
16 64
17 65
18 66
19 67
20 68
21 69
22 70
23 71
24 72
25 73
26 74
27 75
28 76
29 77
30 78
31 79
32 80
33 81
34 82
35 83
36 84
37 85
38 86
39 87
40 88
41 89
42 90
43 91
44 92
45 93
46 94
47 95
48 96

output:

impossible

result:

ok 

Test #64:

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

input:

100 100
88 95
87 44
78 85
54 69
42 4
36 55
30 62
34 82
1 5
69 67
8 77
21 61
22 1
83 47
78 18
100 17
64 38
61 93
22 14
61 16
69 48
70 50
61 3
83 62
59 3
80 66
80 100
78 53
52 13
100 29
82 51
98 98
88 10
90 10
75 3
77 43
50 46
44 11
100 26
24 11
28 55
76 59
54 6
12 5
70 63
85 51
13 82
100 100
43 90
61...

output:

0000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000

result:

ok 

Test #65:

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

input:

95 7
5 67
21 9
18 25
38 61
5 5
33 79
13 61

output:

impossible

result:

ok 

Test #66:

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

input:

2 100
1 1
2 2
1 1
1 1
1 2
1 1
1 1
1 1
1 1
1 1
2 1
2 2
1 2
1 1
2 2
1 1
2 1
2 1
1 2
1 1
1 1
2 2
1 2
2 2
2 2
2 2
2 1
1 2
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 1
2 2
2 1
2 1
2 1
2 1
2 2
2 2
1 1
2 1
2 2
1 1
1 1
2 2
1 2
1 1
2 2
1 2
2 2
2 1
2 2
2 2
1 1
1 1
1 1
1 1
2 1
1 2
1 2
1 1
1 1
2 1
2 2
2 2
1 1
2 2
2 1
1 2
1 ...

output:

0000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok 

Test #67:

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

input:

100 100
13 18
92 97
54 59
42 47
18 23
3 8
23 28
87 92
88 93
94 99
9 14
51 56
62 67
35 40
3 8
44 49
5 10
55 60
4 9
53 58
31 36
36 41
73 78
80 85
40 45
92 97
33 38
82 87
89 94
22 27
28 33
1 6
65 70
34 39
94 99
34 39
88 93
16 21
20 25
76 81
62 67
29 34
26 31
23 28
63 68
80 85
19 24
19 24
34 39
22 27
71...

output:

1001001101111110011100000110100110011100011001101110011001010010011000000001001000111101100110111000

result:

ok 

Test #68:

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

input:

100 97
25 37
63 63
7 13
70 70
49 61
45 50
21 27
29 41
91 100
85 93
35 39
83 90
90 91
45 54
14 18
64 74
88 89
33 35
34 46
35 40
20 30
62 62
6 18
65 67
76 87
74 75
44 48
66 75
5 14
31 40
16 17
59 65
23 31
2 13
96 8
89 97
19 21
60 63
91 98
23 25
25 30
79 91
56 57
54 59
59 65
29 41
82 93
33 34
30 32
12 ...

output:

0000000111111110100110110101000001101010100100000010111100100001000010011010000101000011010110000

result:

ok 

Test #69:

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

input:

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

output:

1010101010101010101010101010101010101010101010101001010101010101010101010101010101010101010101010101

result:

ok 

Subtask #3:

score: 22
Accepted

Dependency #2:

100%
Accepted

Test #70:

score: 22
Accepted
time: 2ms
memory: 3480kb

input:

1000 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #71:

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

input:

1000 957
850 851
94 95
895 896
245 246
553 554
161 162
789 790
945 946
290 291
770 771
645 646
670 671
273 274
479 480
28 29
772 773
755 756
947 948
369 370
608 609
882 883
791 792
734 735
522 523
897 898
234 235
48 50
711 712
925 926
803 804
354 355
907 908
358 359
198 199
822 824
899 900
607 608
3...

output:

111010111011010011010111110011111001001011111001001111100100110001011111001000001101111110001101010000101101000110011110100100010100100001110010001000100000101001101101011100101000100111000001010000010010011100001111010001111000101110010000010010110110000100100001010110010001100111110100010100110010...

result:

ok 

Test #72:

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

input:

998 31
612 670
491 505
791 821
576 611
478 492
280 421
993 64
953 5
888 952
506 575
65 149
278 359
885 900
668 790
901 992
540 595
150 275
809 884
493 539
77 230
231 277
6 76
473 490
443 477
596 667
613 674
422 472
276 279
675 808
822 887
360 442

output:

1101011001101010110000100111100

result:

ok 

Test #73:

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

input:

1000 82
818 844
553 565
267 278
378 389
619 632
308 341
858 882
341 354
380 402
566 600
917 969
419 467
737 753
599 615
780 809
806 811
807 820
611 618
555 600
127 128
690 696
260 267
361 380
636 668
706 737
631 637
683 695
751 777
403 459
630 635
262 273
986 9
54 150
976 999
633 638
777 789
635 660...

output:

0100110011001001010110100100101110001000111101110010011110101101001010011001110101

result:

ok 

Test #74:

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

input:

1000 133
253 269
842 867
668 668
844 882
496 520
458 478
150 166
744 772
920 938
376 389
72 107
445 453
736 744
188 189
110 138
76 110
456 463
991 1000
699 721
578 580
463 495
63 65
701 728
780 807
139 141
922 949
949 953
374 387
895 914
176 188
333 350
892 913
611 627
609 617
361 373
551 578
981 98...

output:

1001100111101100100011110000011110000101011000000111110010010101110111110100111100011000101000100010110110111001000001001000110101110

result:

ok 

Test #75:

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

input:

18 6
10 17
3 13
18 2
14 1
5 16
2 4

output:

000111

result:

ok 

Test #76:

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

input:

1000 492
1 1000
2 999
3 998
4 997
5 996
6 995
7 994
8 993
9 992
10 991
11 990
12 989
13 988
14 987
15 986
16 985
17 984
18 983
19 982
20 981
21 980
22 979
23 978
24 977
25 976
26 975
27 974
28 973
29 972
30 971
31 970
32 969
33 968
34 967
35 966
36 965
37 964
38 963
39 962
40 961
41 960
42 959
43 95...

output:

impossible

result:

ok 

Test #77:

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

input:

1000 502
1 1000
2 999
3 998
4 997
5 996
6 995
7 994
8 993
9 992
10 991
11 990
12 989
13 988
14 987
15 986
16 985
17 984
18 983
19 982
20 981
21 980
22 979
23 978
24 977
25 976
26 975
27 974
28 973
29 972
30 971
31 970
32 969
33 968
34 967
35 966
36 965
37 964
38 963
39 962
40 961
41 960
42 959
43 95...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #78:

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

input:

1000 128
312 329
896 898
364 369
868 871
743 747
560 561
597 608
409 421
225 237
707 719
569 596
976 978
470 479
640 671
29 52
587 587
370 390
519 541
616 634
188 198
720 742
13 28
672 672
341 350
427 431
794 794
238 241
253 298
187 224
238 252
242 242
5 12
616 637
609 615
51 62
177 178
821 833
591 ...

output:

impossible

result:

ok 

Test #79:

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

input:

1000 37
442 473
739 824
240 273
419 424
821 896
140 153
285 327
599 626
387 409
701 326
894 907
170 222
218 239
349 386
410 423
151 170
323 353
572 603
473 509
425 433
338 699
686 743
328 342
271 289
236 241
893 896
133 143
125 136
909 921
432 444
919 923
57 103
99 129
623 689
974 57
508 576
924 974

output:

impossible

result:

ok 

Test #80:

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

input:

1000 859
794 796
103 109
843 848
665 672
126 133
603 603
223 224
296 303
349 356
127 134
754 758
303 310
59 68
868 870
447 460
475 478
94 100
547 549
587 593
327 339
865 874
612 621
132 134
734 742
566 566
794 795
563 564
239 245
827 829
587 592
374 374
877 877
903 905
578 583
402 404
524 534
306 31...

output:

impossible

result:

ok 

Test #81:

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

input:

1000 372
656 659
966 968
100 104
708 713
2 3
189 198
547 548
570 573
979 981
554 564
291 298
538 543
310 318
836 839
880 887
790 791
730 730
196 200
523 526
302 319
559 567
180 188
981 987
77 88
615 619
613 621
607 610
652 657
921 942
564 570
887 893
70 77
186 193
767 772
957 959
161 169
393 398
416...

output:

101111010101111101100010010111100101101110010011010101110011010101011111010000011101000100011100111111110011100111100101101110010100111000000000010110010010011010011000010010000111111010001001110100111001001100101100011010110111110100001010110010011111110111111100110111000100010001111000000001111101...

result:

ok 

Test #82:

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

input:

1000 72
737 780
97 100
255 311
408 440
152 185
525 552
997 44
664 684
477 496
866 984
576 590
590 604
885 20
660 676
102 121
517 529
85 155
546 575
359 405
191 202
471 497
67 91
422 441
574 592
458 488
41 70
580 608
566 575
199 231
48 69
550 583
680 762
727 891
228 280
354 373
3 89
184 207
387 415
9...

output:

011110000000101000111010100010001111110101010100100100101000010101100100

result:

ok 

Test #83:

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

input:

1000 712
244 246
380 381
525 527
225 268
364 365
861 873
589 589
865 873
585 586
766 766
770 771
731 733
653 654
400 402
303 304
423 424
653 665
715 716
239 240
978 979
12 17
82 83
44 44
45 46
685 685
155 156
848 850
672 675
638 645
985 986
274 282
407 408
348 349
191 191
166 167
921 926
272 274
587...

output:

000100010001100111000011101110000111000111001000000000010000111001001000100000000100010101110001010100110100010001000001111010010111011000111000000101000011110100010110011000001100000010100110000111001010001001111100011110100000001100010001001101001000000000000101100100100001101000000000000000000010...

result:

ok 

Test #84:

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

input:

1000 1000
504 505
743 743
220 220
899 899
247 248
456 456
67 71
61 61
692 697
358 358
706 708
373 373
355 357
328 330
630 632
295 295
638 640
618 618
59 59
489 490
233 233
605 605
43 46
175 176
226 229
721 722
831 831
62 62
302 302
431 434
629 629
476 476
193 194
271 271
958 958
720 720
679 679
61 6...

output:

000101100111010111011000110111011110111100011100011101110010111101110000100000110100011011101111010111001000011000100011001001110011001000001001010111010110110010110101101101011010011100100100011100001011001001000000001010101100011110110101100111110000110011010011000111111100100000100101001101000101...

result:

ok 

Test #85:

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

input:

1000 72
6 21
656 658
52 88
461 482
767 841
917 968
96 125
654 655
636 692
159 189
943 944
734 741
648 653
501 533
883 898
387 388
486 558
46 51
699 717
398 433
698 698
126 163
329 351
882 916
899 926
224 257
105 142
998 5
675 733
434 449
465 500
971 997
534 594
258 260
271 323
143 158
366 397
559 56...

output:

000100001110001110101010111000000111011001011111001110000010111101000111

result:

ok 

Test #86:

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

input:

1000 7
664 663
195 464
839 850
937 194
465 691
692 838
851 936

output:

1000000

result:

ok 

Test #87:

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

input:

1000 785
296 297
748 748
241 241
351 352
892 892
583 583
360 362
11 12
983 983
972 972
662 662
251 252
747 747
719 719
361 363
973 973
358 358
910 914
947 948
831 834
385 385
80 81
842 842
720 720
900 900
148 149
363 364
806 806
542 546
432 432
981 981
508 510
501 506
984 984
369 369
55 58
298 300
5...

output:

011011010000111010101101110000011011010010100010100010111011100100100111101000100101011101011111100010111000000101110110011100101111111110101001111101010101111001000110000111110100000110010110000101101110011001110011011010101110101010000110010101110010111011011010000100100101100100010101011001110101...

result:

ok 

Test #88:

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

input:

1000 12
602 602
653 960
602 651
601 601
961 961
652 652
652 961
603 650
962 962
962 601
963 600
651 651

output:

001000100100

result:

ok 

Test #89:

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

input:

1000 500
1 501
1 502
3 503
4 504
5 505
6 506
7 507
8 508
9 509
10 510
11 511
12 512
13 513
14 514
15 515
16 516
17 517
18 518
19 519
20 520
21 521
22 522
23 523
24 524
25 525
26 526
27 527
28 528
29 529
30 530
31 531
32 532
33 533
34 534
35 535
36 536
37 537
38 538
39 539
40 540
41 541
42 542
43 543...

output:

impossible

result:

ok 

Test #90:

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

input:

1000 1000
453 30
821 12
630 52
998 193
416 694
460 378
784 471
473 518
653 668
732 546
828 485
111 847
917 933
31 119
733 31
483 185
60 656
197 42
59 546
586 474
239 397
852 22
220 676
891 872
343 623
417 523
459 880
721 375
812 751
846 897
133 328
81 193
335 629
586 393
526 523
867 116
919 70
490 1...

output:

000100111100011110111001000100010111010000011110010101110110010100010100101001111010100000111111110010000100010010110100011100010111000111100100010010111011001111111100011110001111101100111001100100010101101010001111110110100011011011001010001100101100100110110110110110110101001100011111100110011101...

result:

ok 

Test #91:

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

input:

1000 96
670 539
659 319
488 294
897 257
814 626
243 23
930 669
590 710
982 988
782 274
721 249
869 459
702 399
640 768
705 696
354 726
587 365
44 74
658 941
330 824
918 924
198 199
592 140
260 925
479 42
198 199
642 418
9 343
817 1
462 521
696 168
247 282
532 642
355 541
934 37
716 852
960 914
402 9...

output:

000000001000101100010100010100101100011001010010011001010001010001000000100000100110110000110100

result:

ok 

Test #92:

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

input:

13 1000
13 8
9 10
9 5
13 2
11 3
5 2
7 7
3 2
9 2
7 10
4 4
3 1
10 13
4 4
5 1
7 7
10 5
3 5
9 4
9 8
9 13
10 2
8 1
5 3
4 12
2 10
2 6
12 13
5 3
4 12
5 12
5 1
3 9
8 1
13 3
8 10
4 6
11 11
8 4
2 1
2 3
10 5
9 8
5 2
12 8
2 3
6 6
6 11
2 13
11 3
2 7
12 7
13 11
4 9
1 7
9 3
12 5
9 7
2 13
10 13
9 12
5 2
6 10
1 7
9 ...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #93:

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

input:

1000 11
303 506
683 524
474 90
153 120
15 307
235 615
361 467
753 733
883 778
819 93
842 882

output:

11100110111

result:

ok 

Test #94:

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

input:

1000 2
590 944
493 692

output:

impossible

result:

ok 

Test #95:

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

input:

1000 126
768 818
734 891
651 806
808 820
437 564
813 989
501 640
465 620
9 194
767 819
56 233
300 407
142 258
41 240
478 607
646 795
682 814
443 635
294 388
574 620
150 324
680 739
835 944
370 467
513 645
821 945
603 671
249 279
207 334
851 927
44 144
634 819
227 306
409 478
678 758
601 695
72 260
1...

output:

011010101010100111011110100011110110000010010100100001110010101001011001100000000001110100100100110000000101011011111100100110

result:

ok 

Test #96:

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

input:

1000 1000
578 590
400 412
565 577
578 590
714 726
943 955
966 978
928 940
143 155
33 45
380 392
266 278
169 181
511 523
250 262
131 143
390 402
192 204
563 575
526 538
202 214
303 315
925 937
526 538
779 791
219 231
22 34
644 656
581 593
646 658
374 386
511 523
397 409
290 302
88 100
111 123
232 244...

output:

001110000011011000100011011001000110111101110000001110100011010100000100011100110110011010010000011011111110110111100001010000111010000011011111001101000010101011010000100011010000110000101011110010110001001011011100000010100010000111101011101110011111111011111000110011100011010110000000001100000000...

result:

ok 

Test #97:

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

input:

999 1000
664 674
887 905
37 44
747 758
207 219
33 38
607 619
603 607
256 276
891 892
894 913
265 276
661 664
935 938
391 409
125 144
633 633
698 712
906 922
378 394
737 751
232 238
546 553
60 75
314 318
338 342
975 980
941 954
292 311
78 97
686 705
174 177
650 662
707 708
753 771
107 117
214 228
990...

output:

100001100010110000010111110011100010111100010100001010001011110011100110101000100111011010100001100000001000111011110000011000000110111111101101010101111000110100111011111111100011110011010111101111101001010111001001110111111111000011111111100101100111000010000101111001101011100100100011000100000000...

result:

ok 

Test #98:

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

input:

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

output:

101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...

result:

ok 

Subtask #4:

score: 19
Accepted

Test #99:

score: 19
Accepted
time: 17ms
memory: 4760kb

input:

100000 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 100000
1 10000...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #100:

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

input:

100000 2
1 100000
1 100000

output:

10

result:

ok 

Test #101:

score: 0
Accepted
time: 16ms
memory: 6336kb

input:

100000 50000
1 100000
2 99999
3 99998
4 99997
5 99996
6 99995
7 99994
8 99993
9 99992
10 99991
11 99990
12 99989
13 99988
14 99987
15 99986
16 99985
17 99984
18 99983
19 99982
20 99981
21 99980
22 99979
23 99978
24 99977
25 99976
26 99975
27 99974
28 99973
29 99972
30 99971
31 99970
32 99969
33 9996...

output:

impossible

result:

ok 

Test #102:

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

input:

100000 50002
1 100000
2 99999
3 99998
4 99997
5 99996
6 99995
7 99994
8 99993
9 99992
10 99991
11 99990
12 99989
13 99988
14 99987
15 99986
16 99985
17 99984
18 99983
19 99982
20 99981
21 99980
22 99979
23 99978
24 99977
25 99976
26 99975
27 99974
28 99973
29 99972
30 99971
31 99970
32 99969
33 9996...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #103:

score: 0
Accepted
time: 40ms
memory: 13140kb

input:

100000 95300
17946 17948
33214 33215
731 735
90652 90652
58810 58810
87592 87593
29477 29477
46179 46180
84232 84233
23054 23054
19780 19781
86542 86544
1833 1833
57179 57181
89599 89601
41733 41733
55557 55557
99336 99337
33965 33967
61232 61235
93747 93748
82461 82462
57207 57207
80116 80119
50062...

output:

111000100101011000011111101010111010101110110010101011101100110000111011100100110100110000100011111011101000101111101110011100101011000001111110010110001111110111110110111110011111101101111000000010010110010000111011111000011010010000010011011100110110111110010110001011010010100000111011110001100101...

result:

ok 

Test #104:

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

input:

100000 100000
75549 75554
80044 80047
6417 6421
86978 86979
71524 71524
30213 30215
44117 44122
86155 86156
12307 12312
10752 10758
25906 25907
48486 48491
3699 3706
5181 5185
19141 19142
91549 91555
39281 39281
24073 24077
99472 99473
61188 61191
91680 91686
44693 44695
59888 59893
79404 79409
1577...

output:

impossible

result:

ok 

Test #105:

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

input:

100000 89589
53264 53294
31239 31239
9373 9373
5432 5432
59593 59603
65626 65626
59879 59880
72507 72507
27332 27333
20270 20271
65825 65826
74082 74083
48960 48960
12254 12255
22152 22154
77559 77559
41852 41852
75791 75791
78113 78114
1118 1119
16474 16474
42711 42711
8378 8378
90753 90771
39205 3...

output:

110001001001110110110001001000000001011101100111111010000110000000000010011111010111111110011110110101111100011000110010110100011011111111000000110011010110110000010100011001111101011001101011111110110110100101011011011001101010000001110011011111000111110001000111111101111110101111110100100011101001...

result:

ok 

Test #106:

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

input:

100000 2738
66154 66274
38744 38751
36154 36280
93703 93705
78005 78046
78905 78925
10628 11180
24457 24467
74564 74676
89417 89437
5487 5494
28845 28891
15440 15460
62483 62564
94170 94279
93727 93768
11270 11286
31127 31186
55627 55631
71392 71401
2081 2129
42870 42879
81273 81287
10555 10573
6016...

output:

010000111000111010001000000010100101000100001000010000100110000001111101100100000001000100000110011101110110001001000100111110110110011000100011100010111110101110110110101111010111101001111011010000111001110100110010111110000000001101000101011011010001000110011011111101001101111011110000001010000010...

result:

ok 

Test #107:

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

input:

95001 895
66502 67310
94132 94226
81640 81691
77989 78017
77560 77704
45662 45715
65702 65886
14498 14527
18060 18161
25677 26019
24944 24981
48612 48922
91510 92068
88603 88661
63137 63164
15864 15949
49024 49065
63267 63348
69589 69677
50022 50124
88287 88358
86274 86333
81186 81234
91054 91059
34...

output:

111111111111111111111111011111011111111111111111010101111110111111111110111110011111111001101101111111111111110111110101111111111011111111111111101110110110111011111111111111111110111111101110111111110111111111111111111111111100111111111101111010110111111001111111111111011111111110101101011111111110...

result:

ok 

Test #108:

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

input:

100000 100000
61960 61961
23345 23345
42152 42155
65731 65732
15255 15255
97217 97217
72421 72421
76359 76359
85944 85945
44583 44585
685 686
60092 60093
16778 16778
41143 41144
63546 63548
27672 27672
372 372
98822 98824
93256 93256
62360 62363
86857 86858
92045 92045
11187 11189
14744 14745
84221 ...

output:

101111110111101100111110100100000111100110101110100100110111111101011111001001011110001100110110000101110101010001101010011000011110011001101100100011000011111101011100111010000000000001101010101001001001000101100011101001101000110100010000000010010001001110111100111011000000011010000001000101011001...

result:

ok 

Test #109:

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

input:

100000 73821
4285 4286
90944 90944
2508 2514
18311 18311
1952 1961
60034 60036
6154 6154
62101 62101
67912 67912
83924 83924
91312 91313
1022 1029
79564 79564
36355 36355
15042 15043
70819 70819
21613 21613
89368 89368
30433 30433
77431 77431
73423 73423
140 140
1331 1331
61330 61330
58967 58967
770...

output:

110100000001000110111111000011101000000110110110101011110001101010001101100100011100000100100110110000000000110101000001001011010010000000000011110000011101010011000011110101100010010110100000110110100110111001001101101010010100101000110100101000100011000000111111100101000110010111000111110010000011...

result:

ok 

Test #110:

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

input:

100000 89589
42166 42166
5791 5791
73679 73679
19050 19050
53416 53417
60918 60918
4014 4014
22564 22565
17347 17347
4258 4258
98963 98963
43102 43102
37051 37051
45188 45188
11010 11010
88180 88180
50743 50743
47297 47297
50811 50811
58415 58415
83689 83690
61591 61591
44409 44409
14035 14035
84591...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #111:

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

input:

100000 13
97338 99998
37423 37423
37424 37424
2 37422
97337 99999
1 37423
97336 97336
37425 97335
97337 97337
83068 83069
37424 97336
1 1
99999 99999

output:

impossible

result:

ok 

Test #112:

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

input:

100000 26
99724 99724
86351 86351
37782 37782
99723 99999
37777 54855
37776 37776
21550 37781
99724 99998
47093 47101
54856 54856
21549 21549
37776 54856
54857 86350
54856 54856
2 21548
99999 99999
1 1
21549 37782
86352 99723
21549 21549
1 21549
86351 99724
7099 7104
54856 86351
99723 99723
86351 86...

output:

impossible

result:

ok 

Test #113:

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

input:

100000 100000
43819 43819
19662 19662
94254 94254
94120 94120
29659 29659
77522 77522
15499 15499
88184 88184
7147 7150
80662 80662
38618 38618
99684 99684
28126 28126
22721 22724
35 35
90009 90009
43564 43564
95283 95283
29548 29563
45733 45733
73787 73787
86049 86049
80277 80278
79792 79813
86385 ...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #114:

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

input:

100000 50000
1 50001
1 50002
3 50003
4 50004
5 50005
6 50006
7 50007
8 50008
9 50009
10 50010
11 50011
12 50012
13 50013
14 50014
15 50015
16 50016
17 50017
18 50018
19 50019
20 50020
21 50021
22 50022
23 50023
24 50024
25 50025
26 50026
27 50027
28 50028
29 50029
30 50030
31 50031
32 50032
33 50033...

output:

impossible

result:

ok 

Test #115:

score: 0
Accepted
time: 95ms
memory: 12180kb

input:

100000 100000
48604 69878
86940 92543
79721 85411
16548 74282
46876 69963
29366 42998
8900 29798
74957 91712
38061 66357
15622 31335
35458 48065
13100 45073
5610 41448
12880 74822
3636 74560
83232 89865
23164 75775
8574 76804
67437 71847
41473 58162
30664 87190
1159 60461
9222 12441
51769 78797
4728...

output:

111011111010000110111001111111011111010101011111011101101001000111110111101111011101001111000111001110111000011111111100011111001000111111100111010101110010011001100000000111100111011111101101110101100111111111000001101011101101001101101111100111101111111111110001010110001111000111010000011011011101...

result:

ok 

Test #116:

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

input:

5784 99999
914 5668
2935 4422
1907 5030
3298 4917
3324 3476
2179 2611
101 2155
838 1824
992 5079
2322 2563
447 728
1754 3021
3523 3883
4964 5381
3149 5675
3033 3077
677 1586
183 5706
3492 4971
1031 3219
2662 5270
3514 4688
5209 5242
449 5397
2176 4375
2643 4821
2775 5663
385 790
3634 5625
998 5765
2...

output:

111111011111111110111111111011101011111101111101111111110001111111101111101111101110011111111111111111111111111011111111111111101111111111111111101111111011111111111111111111011111111111011111111111110111111111111111111010111111111111011111111111111100111111111111010111111110111110111011111111110111...

result:

ok 

Test #117:

score: 0
Accepted
time: 7ms
memory: 10144kb

input:

100000 5783
32129 78865
13677 77138
34402 40354
62683 82427
70542 92665
1075 63609
23981 80006
29318 44916
22457 66000
26598 81959
58199 66956
4160 48353
41188 63293
74614 83529
50056 52482
963 37735
28921 31224
14639 79674
71577 77321
78453 80594
58413 64214
44220 98020
42935 98745
64745 89889
1648...

output:

impossible

result:

ok 

Test #118:

score: 0
Accepted
time: 45ms
memory: 11428kb

input:

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

output:

101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...

result:

ok 

Subtask #5:

score: 26
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #119:

score: 26
Accepted
time: 2ms
memory: 7724kb

input:

100000 83
97082 264
58314 60008
27938 30795
77655 80940
31170 32198
57617 58370
91693 92497
20092 23433
94438 97081
85265 89485
92159 93560
68543 68870
31820 33068
73741 74855
65798 67297
53228 57616
77478 80708
82060 83217
74780 75421
19451 20091
77018 77654
19593 22285
50888 54816
30796 31819
1069...

output:

10011111110101010001100011000101000100111101001011101011010010111011000011100001000

result:

ok 

Test #120:

score: 0
Accepted
time: 45ms
memory: 11356kb

input:

100000 71823
91383 91385
88525 88528
55231 55232
43984 43985
68486 68487
71603 71605
67709 67710
32393 32394
85977 85978
77162 77163
50578 50579
18347 18348
66311 66312
21258 21260
78444 78445
44238 44240
88990 88993
62771 62772
63571 63572
33178 33180
87633 87634
19215 19217
34261 34263
3515 3516
8...

output:

100000111100111010011011100100110010101001110101110001000110010110100011011010010000110000001101100101011110100001101101000101010011011001100001010110010000101000010110110000101100100100000010101011000000111001001011011110001001110110011011011011010010101101001000111111011100111011101101001011010010...

result:

ok 

Test #121:

score: 0
Accepted
time: 28ms
memory: 10852kb

input:

100000 44825
13608 13610
14791 14793
84958 84960
99164 99167
81855 81856
64621 64622
56076 56077
20490 20492
72886 72887
70393 70397
44289 44291
92121 92122
51546 51547
60744 60747
45791 45793
51957 51959
96623 96624
57175 57180
75053 75056
39790 39795
8048 8050
10147 10148
48553 48555
2838 2839
410...

output:

100001110001101000110101101101000100000000111010111110100000111111110001111101111100110111000111110000100111101110111000011100000010001111000011010001011010111000110101101100010111010100101101111000100100101001000001010100101100101100101010000110011011100001011100011000100000011001011110001101110001...

result:

ok 

Test #122:

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

input:

13 4
1 7
8 2
3 8
5 13

output:

1001

result:

ok 

Test #123:

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

input:

100000 5000
54313 54360
5646 5660
69510 69512
33294 33321
40600 40660
16211 16214
98211 98230
23964 23965
85456 85462
16901 16909
87479 87510
99655 99657
32085 32107
28173 28302
56453 56473
2530 2559
11550 11563
12673 12786
12731 12808
75864 75903
72874 72943
24365 24392
17591 17620
69462 69477
7649...

output:

impossible

result:

ok 

Test #124:

score: 0
Accepted
time: 38ms
memory: 11036kb

input:

100000 35938
72960 72961
41897 41906
61155 61161
80934 80936
14205 14208
10928 10936
88577 88584
63831 63834
92099 92108
23311 23311
70272 70274
79867 79872
92838 92852
39850 39859
12385 12388
49053 49066
19599 19600
40881 40893
43946 43951
35864 35867
61544 61545
57942 57951
72971 72973
94718 94732...

output:

impossible

result:

ok 

Test #125:

score: 0
Accepted
time: 18ms
memory: 10720kb

input:

100000 27813
83596 83610
25500 25507
94491 94493
70793 70800
57406 57408
52707 52715
4909 4938
38831 38837
79558 79563
49161 49167
95159 95159
96714 96716
96493 96502
96717 96730
62694 62702
75135 75144
58816 58818
71912 71923
7669 7683
3859 3861
38898 38899
31241 31241
88079 88080
84780 84792
53079...

output:

001000110101010100000111011100111111010111000100001001010001101001000000011011001110001011100001110110101000011001011000011101010011111001111101011111010111011100110010011100110110101101000100101011110001101000100110000000000001010100001111010101001011111101110101100001010010101111010101100001011010...

result:

ok 

Test #126:

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

input:

100000 183
17997 18981
41244 42763
83583 83920
64053 66274
35224 38508
92935 93336
20102 20373
5492 5966
12734 13636
48536 48537
45359 47453
54395 54449
28435 28663
99499 67
20114 21025
78184 79961
59387 63518
58082 59908
20349 20716
66449 66453
40289 40591
66444 66484
73682 73741
99517 275
80897 81...

output:

101001101001000110110111000010110001011100010110110011010001111011111101010001101010001111111010111100100100100001101011010011111010001100110101100000001101000001101100100010101111111

result:

ok 

Test #127:

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

input:

100000 8492
47475 47489
36721 36802
60641 60705
99398 99412
55982 56030
21727 21849
62433 62435
45546 45567
37406 37461
66667 66672
89896 89899
70237 70246
73632 73651
74476 74540
36796 37097
88689 88691
60388 60462
52332 52527
60095 60124
33695 33745
28008 28013
87246 87253
72997 73030
92690 92695
...

output:

010110110111111100011000011010100011011111101111110001010111001100011101010100001101010101000000001011111010101101101001011100110010100110011011101011001010101011100011011010001010110110110110000011100001110101101011100001000111001011101110010100011010000010000111000011010101110011101010010011101010...

result:

ok 

Test #128:

score: 0
Accepted
time: 39ms
memory: 12568kb

input:

100000 78324
28698 28699
35069 35072
76394 76394
43963 43964
35132 35133
67349 67350
69615 69615
86951 86952
90773 90773
24456 24456
14172 14174
97117 97121
94642 94642
42617 42619
17644 17644
47490 47491
41616 41616
21147 21147
8640 8641
68003 68005
55003 55008
62160 62167
7596 7598
28364 28364
129...

output:

100000101010110000001010000110111101110011010110110111110100010000001001001110011011110011100100110000100110011111110001110001001001101111011001110100100000111110111100110001101110001101000101001101010110000110001010111010000010100010110110001001010100101010110001111000000101011010110101001111111000...

result:

ok 

Test #129:

score: 0
Accepted
time: 22ms
memory: 11268kb

input:

100000 47395
47176 47178
12591 12592
27101 27103
72362 72362
84134 84134
58714 58714
9054 9057
84463 84463
81749 81752
73686 73688
94348 94348
60267 60270
55148 55149
80701 80704
6227 6228
59500 59500
66036 66036
25152 25154
63462 63496
95278 95278
26512 26513
10210 10211
43595 43601
36439 36440
898...

output:

100111100100100110010100010101111001011011001110110100001010000111011100000011101111011011110101011010001010100101111000001110101110110111101000011010111101010100000000010001100001010100001111010001000101000011000000010110000000011110011111010001011100001011101000010100110101111110000010011000101001...

result:

ok 

Test #130:

score: 0
Accepted
time: 38ms
memory: 11708kb

input:

100000 57253
41905 41905
80018 80018
48456 48463
88057 88057
89262 89264
36008 36010
27079 27084
55541 55553
15727 15729
96395 96398
31053 31058
6472 6472
65999 66001
69392 69392
14747 14749
6693 6693
65229 65232
1200 1201
39596 39601
19209 19209
55796 55796
55315 55320
95129 95134
16263 16263
29210...

output:

101010101101100101011111100000000000010101110100101111011010100001011010100111011101010100011110111011110111011011001101010111100100100100010001100100111101101011110000010110100101111000110100010000001010100100110110010010000010101000101100101110000101011000111010110110100001011001010111110001010111...

result:

ok 

Test #131:

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

input:

100000 75
61203 75935
19142 19142
40634 40641
19065 26667
96661 19142
75924 75924
58485 58490
89724 89724
88256 89724
19065 19065
96662 19141
89722 90742
94509 94509
97663 97668
94509 96683
89722 89722
19066 26666
7200 7203
90738 90738
96764 96764
75924 88289
86811 86818
27878 27884
90739 92377
6352...

output:

010011000001000110001001101100100010101100010111010001100000110111001000000

result:

ok 

Test #132:

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

input:

100000 248
13698 13698
88149 89905
9588 9588
31127 31127
74987 76599
64099 69320
12367 12367
44363 45346
18718 20606
13352 13656
61286 62108
54752 59875
94211 96798
94212 96797
89906 89906
26045 26045
20607 20607
76602 78520
61284 61284
84359 85568
54185 54185
2346 2346
54403 54750
25614 25998
9589 ...

output:

00000001000010000000001110001000010000000010010000111000001100000000000000110000001001000000010110000010011000010100000000000100001010100000001000000100110100000010100010001011000111001001000000000111000111000011100010100000001000100000001010001000

result:

ok 

Test #133:

score: 0
Accepted
time: 62ms
memory: 6872kb

input:

100000 100000
66202 66762
48635 45911
48085 64882
78401 47314
89129 246
31778 59972
24594 21113
31843 86427
48022 68436
86759 84784
55910 88423
2993 86578
90658 65179
51681 3538
2769 53620
6588 68970
36734 71574
14881 84818
36456 9633
32131 41936
26230 80260
18259 50824
1372 50102
53602 49393
34889 ...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #134:

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

input:

100000 27428
32053 1078
73956 34567
50817 72192
84077 23181
36822 79784
84728 68943
21923 25463
8596 96161
19157 31426
57609 73090
40241 59971
7904 49957
14468 44079
75628 72348
29154 26030
7819 77558
27108 81774
12124 94276
70317 12553
17456 7138
92336 18535
92432 30610
60350 1028
43122 95858
48805...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #135:

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

input:

100000 12
33187 36470
51122 10051
58999 43147
76765 22321
41406 62303
69190 72458
62394 95314
34498 49045
46379 27809
88479 49513
35732 54723
39106 5261

output:

000111101110

result:

ok 

Test #136:

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

input:

100000 57835
44063 44083
57362 57382
6474 6494
4303 4323
7675 7695
19009 19029
35252 35272
86129 86149
1900 1920
56819 56839
4543 4563
33571 33591
94589 94609
25958 25978
15780 15800
47342 47362
82394 82414
88183 88203
38274 38294
89687 89707
44610 44630
45754 45774
28803 28823
98693 98713
29819 298...

output:

impossible

result:

ok 

Test #137:

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

input:

100000 78342
18495 18510
99199 99230
17019 17022
60395 60401
10098 10107
91529 91548
26486 26491
76247 76263
83279 83310
77273 77291
62773 62787
39151 39153
32044 32066
80437 80465
77564 77572
69139 69141
36010 36022
29990 29998
36042 36043
75491 75514
62433 62438
52929 52962
1695 1725
64130 64143
3...

output:

impossible

result:

ok 

Test #138:

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

input:

99999 1001
88254 90204
38079 39322
483 618
72436 73047
19277 20562
87967 88258
19159 19762
84674 85932
53626 54530
50520 51287
629 1432
21849 22431
58850 60563
56213 57377
85569 87283
97462 99039
53319 55082
73844 74127
58408 59162
28200 28397
38524 40392
25638 26382
95140 96859
72407 74255
27798 27...

output:

101101010111100001010000111111011011101001110011100110111100000111111110000100100010100000110101101001101010001110001011110101011000011100101011111111001111111100010110001111101101011110000100011001111100110001101000101000101101111000010111111011010010111011110101001011000110110010111000001100010001...

result:

ok