QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#589698#5550. JOIRISyellowbird100 ✓1ms3840kbC++202.1kb2024-09-25 19:46:252024-09-25 19:46:26

详细

Subtask #1:

score: 15
Accepted

Test #1:

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

input:

34 2
2
5
41
47
8
27
42
17
43
47
47
12
49
33
41
18
4
16
15
28
9
13
25
44
20
40
25
16
2
20
0
41
6
16

output:

-1

result:

ok 

Test #2:

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

input:

26 2
32
42
0
0
20
22
4
19
13
37
22
30
50
17
23
1
11
7
22
3
26
25
45
32
38
38

output:

-1

result:

ok 

Test #3:

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

input:

32 2
3
42
8
32
34
44
2
4
19
40
49
47
25
6
46
7
40
22
38
6
32
45
4
35
16
29
47
6
1
22
0
14

output:

-1

result:

ok 

Test #4:

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

input:

28 2
9
21
26
30
0
46
33
7
36
29
28
0
33
21
29
37
15
44
33
14
14
34
32
4
49
23
48
19

output:

1351
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 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5...

result:

ok 

Test #5:

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

input:

48 2
46
2
38
42
24
39
45
26
36
10
43
12
44
44
9
23
5
38
1
25
31
46
21
5
0
19
49
28
0
2
39
4
42
29
5
28
46
20
13
44
6
8
26
43
7
11
15
2

output:

-1

result:

ok 

Test #6:

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

input:

12 2
30
34
48
32
0
10
20
21
36
8
12
19

output:

273
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 7
1 7
1 7
1 7
1 7
1 7
1 7
...

result:

ok 

Test #7:

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

input:

28 2
23
5
49
37
34
46
50
15
14
12
28
13
38
21
2
19
13
21
0
35
42
28
35
7
44
15
13
44

output:

-1

result:

ok 

Test #8:

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

input:

38 2
42
43
50
3
2
50
23
16
26
45
17
32
20
8
45
17
3
6
12
4
14
26
43
9
49
46
37
12
9
1
12
31
34
35
10
7
32
0

output:

-1

result:

ok 

Test #9:

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

input:

42 2
44
20
50
41
29
16
14
21
34
43
23
19
50
3
16
49
18
22
21
49
29
48
33
44
17
0
26
26
39
24
6
29
5
39
40
25
4
50
48
6
1
39

output:

2234
1 1
1 1
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 8
1 8
1 8
1 8
1 8...

result:

ok 

Test #10:

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

input:

8 2
19
24
12
6
0
21
42
11

output:

-1

result:

ok 

Test #11:

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

input:

2 2
0
1

output:

-1

result:

ok 

Test #12:

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

input:

2 2
50
0

output:

25
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2

result:

ok 

Test #13:

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

input:

50 2
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

output:

-1

result:

ok 

Test #14:

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

input:

50 2
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0

output:

-1

result:

ok 

Test #15:

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

input:

50 2
0
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50

output:

25
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

result:

ok 

Test #16:

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

input:

50 2
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
0
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50

output:

25
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27

result:

ok 

Subtask #2:

score: 15
Accepted

Test #17:

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

input:

3 2
38
27
0

output:

35
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
2 2
1 1
1 1
1 2
1 3
2 1
1 3
1 3
1 1
1 2

result:

ok 

Test #18:

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

input:

27 2
31
48
37
30
48
31
7
0
43
22
34
18
7
34
15
29
35
22
28
27
38
15
29
30
35
8
15

output:

1235
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8...

result:

ok 

Test #19:

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

input:

19 2
26
12
20
18
44
46
2
28
17
47
3
35
0
42
43
40
4
45
42

output:

408
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
...

result:

ok 

Test #20:

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

input:

29 2
40
19
38
29
10
48
4
3
30
42
29
21
28
27
43
2
7
24
27
39
0
13
21
35
48
15
7
33
34

output:

1353
1 1
1 1
1 1
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7...

result:

ok 

Test #21:

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

input:

31 2
2
12
34
40
35
39
47
46
5
9
17
18
24
38
41
48
44
0
30
13
2
20
16
47
12
41
24
31
31
43
6

output:

1561
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 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 6
1 6
1 6
1 6
1 6
1 7
1 8
1 9
1 9
1 9
1 9
1 9
1 9
1 9
1 9...

result:

ok 

Test #22:

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

input:

5 2
29
14
34
0
14

output:

62
1 1
1 1
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
2 2
1 1
1 1
1 4
1 4
1 5
1 5
1 2
1 2
1 3
1 3
1 4
1 5
2 4
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 5

result:

ok 

Test #23:

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

input:

7 2
18
38
0
7
7
45
43

output:

110
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 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
...

result:

ok 

Test #24:

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

input:

19 2
21
6
30
23
38
46
10
37
3
39
35
13
0
6
44
41
45
22
14

output:

666
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 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
...

result:

ok 

Test #25:

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

input:

19 2
47
30
36
24
22
25
5
9
20
7
19
8
44
11
45
24
22
0
48

output:

613
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
...

result:

ok 

Test #26:

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

input:

19 2
8
11
10
27
23
26
9
36
3
2
46
0
47
46
26
29
19
5
0

output:

773
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 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
...

result:

ok 

Test #27:

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

input:

3 2
0
1
2

output:

12
1 1
1 2
2 2
1 1
1 1
1 2
1 3
2 1
1 3
1 3
1 1
1 2

result:

ok 

Test #28:

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

input:

3 2
0
2
1

output:

9
1 1
1 3
2 1
1 3
1 3
1 1
1 1
1 2
1 2

result:

ok 

Test #29:

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

input:

49 2
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0

output:

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

result:

ok 

Test #30:

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

input:

49 2
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

output:

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

result:

ok 

Test #31:

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

input:

49 2
0
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50

output:

25
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

result:

ok 

Test #32:

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

input:

49 2
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
0
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50
50

output:

25
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27
1 27

result:

ok 

Subtask #3:

score: 15
Accepted

Dependency #1:

100%
Accepted

Test #33:

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

input:

3 3
20
0
26

output:

-1

result:

ok 

Test #34:

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

input:

4 2
21
36
0
19

output:

58
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
2 2
1 1
1 1
1 4
1 4
1 2
1 2
1 3
1 3
2 3
1 1
1 1
1 2
1 2
1 3
1 4
2 1
1 3
1 3
1 4
1 4
1 1
1 2

result:

ok 

Test #35:

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

input:

10 5
2
27
17
0
4
26
7
50
41
3

output:

-1

result:

ok 

Test #36:

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

input:

24 6
27
20
23
19
30
40
49
35
19
27
7
45
37
17
0
11
36
2
32
28
43
39
23
16

output:

-1

result:

ok 

Test #37:

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

input:

39 13
34
40
36
9
46
24
34
0
14
44
3
42
7
43
43
12
24
18
31
48
36
2
34
33
48
47
11
16
18
39
3
38
11
41
42
8
15
23
36

output:

-1

result:

ok 

Test #38:

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

input:

42 7
9
19
27
32
23
49
20
19
26
28
24
21
27
44
29
40
3
47
29
5
46
24
21
45
9
1
2
23
50
24
37
0
18
6
27
27
18
34
20
30
27
11

output:

-1

result:

ok 

Test #39:

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

input:

46 23
36
40
6
34
18
0
16
32
4
18
13
47
4
45
27
30
16
21
26
11
21
34
35
28
36
28
24
8
20
36
1
12
29
49
21
15
30
41
33
32
44
46
6
11
10
15

output:

-1

result:

ok 

Test #40:

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

input:

47 47
18
21
16
42
0
7
5
11
14
15
45
41
2
17
32
40
16
33
24
32
10
10
49
34
44
12
33
14
34
47
40
22
39
48
11
23
32
44
44
48
45
22
37
26
49
5
18

output:

-1

result:

ok 

Test #41:

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

input:

49 7
50
9
16
17
5
47
18
0
6
45
28
10
30
34
6
0
27
1
11
39
2
6
1
39
33
6
5
2
12
11
41
16
11
38
39
12
6
6
39
34
0
48
15
49
30
14
50
8
27

output:

-1

result:

ok 

Test #42:

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

input:

50 5
45
27
44
21
35
4
39
0
47
6
46
11
47
39
47
42
25
18
15
20
18
16
34
0
43
46
1
42
18
20
41
38
45
40
37
44
11
3
39
28
21
47
2
31
30
13
18
16
30
8

output:

-1

result:

ok 

Test #43:

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

input:

48 4
1
0
1
2
1
0
1
2
1
0
1
2
1
0
1
2
1
0
1
2
1
0
1
2
1
0
1
2
1
0
1
2
1
0
1
2
1
0
1
2
1
0
1
2
1
0
1
2

output:

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

result:

ok 

Test #44:

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

input:

4 2
6
0
4
10

output:

10
1 1
1 1
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3

result:

ok 

Test #45:

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

input:

10 5
27
25
46
22
24
19
21
0
24
22

output:

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

result:

ok 

Test #46:

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

input:

24 6
3
2
4
4
4
3
4
2
4
4
2
2
3
11
2
2
6
7
5
0
5
5
3
3

output:

777
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 15
1 16
1 19
1 20
1 21
1 22
1 23
1 24
2 6
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 12
1 12
1 13
1 13
1 14
1 14
1 15
1 15
1 16
1 16
1 17
1 17
1 18
1 18
1 19
1 19
1 20
1 20
1 21
1 21
1 22
1 22
1 23
1 23
1 24
1 24
1 6
1 6
1 7
1 7
1 8
1 8
1 ...

result:

ok 

Test #47:

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

input:

39 13
24
26
29
33
25
31
30
25
0
34
29
30
27
33
26
26
23
30
23
25
27
43
23
29
25
27
26
31
28
27
28
29
28
31
40
26
25
28
29

output:

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

result:

ok 

Test #48:

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

input:

42 7
8
9
0
5
10
8
8
9
11
6
11
13
8
10
8
12
8
10
5
9
6
5
5
12
8
6
6
11
9
4
12
10
6
8
8
10
8
11
5
9
10
6

output:

2891
1 3
1 4
1 10
1 19
1 21
1 22
1 23
1 26
1 27
1 30
1 33
1 39
1 42
2 14
2 14
2 14
2 14
2 14
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 10
1 10
1 11
1 11
1 12
1 12
1 13
1 13
1 21
1 21
1 22
1 22
1 23
1 23
1 24
1 24
1 25
1 25
1 26
1 26
1 27
1 27
1 28
1 28
1 29
1 29
1 30
...

result:

ok 

Test #49:

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

input:

46 23
13
7
8
8
9
11
9
8
9
10
12
19
10
9
5
9
11
10
6
6
9
8
10
6
12
11
11
10
8
10
11
10
9
7
0
9
10
14
10
8
9
13
13
10
11
9

output:

2419
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
2 23
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 10
1 10
1 11
1 11
1 12
1 12
1 13
1 13
1 14
1 14
1 15
1 15
1 16
1 16
1 17
1 17
1 18
1 18
1 19
1 19
1 20
1 20
1 21
1 2...

result:

ok 

Test #50:

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

input:

48 4
1
2
3
36
0
3
2
50
1
2
3
36
0
3
2
50
1
2
3
36
0
3
2
50
1
2
3
36
0
3
2
50
1
2
3
36
0
3
2
50
1
2
3
36
0
3
2
50

output:

-1

result:

ok 

Test #51:

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

input:

49 7
4
7
7
8
7
9
4
9
3
8
7
4
7
8
7
10
5
4
12
3
10
7
6
7
6
5
5
13
11
4
6
10
8
12
0
8
9
5
8
8
8
6
3
10
11
6
5
5
8

output:

4312
1 1
1 7
1 9
1 12
1 17
1 18
1 20
1 23
1 25
1 26
1 27
1 30
1 31
1 35
1 38
1 42
1 43
1 46
1 47
1 48
2 7
2 7
2 7
2 7
2 7
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 14
1 14
1 15
1 15
1 16
1 16
1 17
1 17
1 18
1 18
1 19
1 19
1 20
1 20
1 21
1 21
1 22
1 22
1 23
1 23
1 24
1 24
1 25
1 25
1 26
1 26
...

result:

ok 

Test #52:

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

input:

50 5
6
3
11
2
3
1
8
4
5
11
8
2
5
8
6
3
4
4
4
4
5
8
4
3
3
6
7
5
8
0
9
5
3
5
5
2
1
6
6
7
6
6
4
5
6
2
4
2
2
3

output:

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

result:

ok 

Test #53:

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

input:

2 1
50
0

output:

50
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2

result:

ok 

Test #54:

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

input:

5 1
0
1
2
3
4

output:

10
1 1
1 1
1 1
1 1
1 2
1 2
1 2
1 3
1 3
1 4

result:

ok 

Subtask #4:

score: 55
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #55:

score: 55
Accepted
time: 0ms
memory: 3660kb

input:

5 3
3
29
39
37
0

output:

-1

result:

ok 

Test #56:

score: 55
Accepted
time: 0ms
memory: 3720kb

input:

10 3
37
20
0
33
19
15
48
19
25
47

output:

219
1 1
1 1
1 1
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 9
1 9
1 9
1 9
1 9
1 9
1 9
1 9
...

result:

ok 

Test #57:

score: 55
Accepted
time: 0ms
memory: 3644kb

input:

16 5
30
5
49
15
7
5
20
39
47
50
10
33
0
31
22
11

output:

-1

result:

ok 

Test #58:

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

input:

22 10
49
26
1
0
4
20
4
49
45
13
43
28
27
44
47
20
50
10
50
31
21
48

output:

-1

result:

ok 

Test #59:

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

input:

30 29
33
31
14
9
29
40
11
25
17
13
38
27
9
48
49
0
19
31
47
9
46
1
21
18
38
19
46
19
20
24

output:

-1

result:

ok 

Test #60:

score: 55
Accepted
time: 0ms
memory: 3704kb

input:

41 3
37
16
4
18
47
12
47
17
16
2
0
11
8
36
20
42
45
12
23
50
35
30
28
40
42
38
37
20
10
18
16
35
35
20
43
40
0
35
29
18
30

output:

-1

result:

ok 

Test #61:

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

input:

45 13
37
10
34
2
8
39
23
34
14
37
24
35
27
40
21
32
45
30
31
42
5
17
5
28
47
24
34
38
22
47
45
19
1
38
49
40
1
16
44
5
3
8
11
0
14

output:

-1

result:

ok 

Test #62:

score: 55
Accepted
time: 0ms
memory: 3656kb

input:

47 18
31
4
25
23
47
16
41
49
22
22
32
30
32
11
1
4
50
26
21
0
37
24
9
34
15
38
15
21
13
25
46
27
35
8
5
23
37
29
40
28
9
0
23
11
40
5
20

output:

-1

result:

ok 

Test #63:

score: 55
Accepted
time: 1ms
memory: 3740kb

input:

49 3
5
11
4
8
13
1
37
23
32
34
0
35
37
37
1
2
38
31
39
40
0
36
19
14
20
27
45
4
45
29
2
15
33
48
24
24
35
32
31
19
26
44
2
1
11
48
28
23
29

output:

4160
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 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 6
1 6
1 6
1 6
1 6...

result:

ok 

Test #64:

score: 55
Accepted
time: 0ms
memory: 3660kb

input:

50 49
1
25
23
43
1
23
33
45
13
43
46
36
35
5
26
5
32
24
49
34
40
40
26
45
24
35
38
41
23
0
2
17
4
27
10
46
17
50
1
37
27
5
15
1
43
11
42
11
50
26

output:

-1

result:

ok 

Test #65:

score: 55
Accepted
time: 0ms
memory: 3592kb

input:

4 3
17
0
0
16

output:

29
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
2 1
1 4
1 4
1 1
1 1
1 2
1 2
1 3
1 3
2 2
2 2
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4

result:

ok 

Test #66:

score: 55
Accepted
time: 0ms
memory: 3600kb

input:

5 3
1
1
0
0
0

output:

11
2 3
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5

result:

ok 

Test #67:

score: 55
Accepted
time: 0ms
memory: 3712kb

input:

7 5
11
30
0
0
0
19
0

output:

65
1 1
1 1
1 1
1 1
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 6
1 6
1 6
1 7
1 7
1 7
1 7
1 7
1 7
2 1
2 1
2 1
2 1
1 6
1 6
1 7
1 7
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 7
2 2
1 1
1 1
1 7
1 7
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6

result:

ok 

Test #68:

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

input:

10 3
21
1
1
17
1
0
14
1
2
0

output:

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

result:

ok 

Test #69:

score: 55
Accepted
time: 0ms
memory: 3728kb

input:

13 3
41
7
7
38
9
10
0
11
7
34
9
12
44

output:

370
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
...

result:

ok 

Test #70:

score: 55
Accepted
time: 0ms
memory: 3608kb

input:

16 5
17
10
12
13
15
12
14
9
12
11
0
12
15
11
10
20

output:

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

result:

ok 

Test #71:

score: 55
Accepted
time: 0ms
memory: 3680kb

input:

19 10
23
24
22
21
23
27
45
25
23
0
22
21
23
24
22
18
0
20
22

output:

444
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 8
1 8
1 9
1 9
1 10
1 10
1 10
1 10
1 11
1 11
1 12
1 12
1 13
1 13
1 14
1 14
1 15
1 15
1 16
1 16
1 16
1 17
1 17
1 17
1 17
1 18
1 18
1 19
1 19
2 10
2 10
2 10
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 3
1 4
1 10
1 10
1 ...

result:

ok 

Test #72:

score: 55
Accepted
time: 0ms
memory: 3604kb

input:

22 10
34
24
13
15
13
13
15
15
12
13
37
25
13
11
13
13
11
11
14
13
0
22

output:

526
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 10
1 10
1 12
1 13
1 13
1 14
1 14
1 15
1 15
1 16
1 16
1 17
1 17
1 18
1 18
1 19
1 19
1 20
1 20
1 21
1 21
1 21
1 22
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 20...

result:

ok 

Test #73:

score: 55
Accepted
time: 0ms
memory: 3680kb

input:

23 8
19
28
22
9
17
17
19
11
18
25
14
21
18
15
18
9
16
0
17
23
18
21
16

output:

713
1 1
1 3
1 4
1 4
1 5
1 6
1 7
1 8
1 8
1 9
1 11
1 11
1 12
1 13
1 14
1 14
1 15
1 16
1 16
1 17
1 18
1 18
1 18
1 19
1 20
1 21
1 22
1 23
2 16
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 10
1 10
1 11
1 11
1 12
1 12
1 13
1 13
1 14
1 14
1 15
1 15
1 16
1 16
1 17
1 17
1 18
1 18...

result:

ok 

Test #74:

score: 55
Accepted
time: 0ms
memory: 3604kb

input:

30 29
24
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
24

output:

168
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 30
1 30
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 10
1 10
1 11
1 11
1 12
1 12
1 13
1 13
1 14
1 14
1 15
1 15
1 16
1 16
1 17
1 17
1 18
1 18
1 19
1 19
1 20
1 20
1 21
1 2...

result:

ok 

Test #75:

score: 55
Accepted
time: 0ms
memory: 3724kb

input:

36 34
12
12
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
11
11

output:

167
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 35
1 35
1 36
1 36
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 10
1 10
1 11
1 11
1 12
1 12
1 13
1 13
1 14
1 14
1 15
1 15
1 16
1 16
1 17
1 17
1 18
1 18
1 19
1 19
1 20
1 20
1 21
1 21
1 22
1 22
1 23
1 23
1 24
1 24
1 25
1 25
...

result:

ok 

Test #76:

score: 55
Accepted
time: 1ms
memory: 3712kb

input:

41 3
3
3
5
3
2
5
0
0
1
1
1
3
2
0
3
0
0
2
1
3
2
1
1
6
0
3
3
0
1
1
1
1
7
0
1
5
2
0
3
2
0

output:

2803
1 1
1 2
1 3
1 4
1 5
1 5
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 10
1 10
1 11
1 11
1 12
1 13
1 13
1 14
1 14
1 15
1 16
1 16
1 17
1 17
1 18
1 18
1 19
1 19
1 20
1 21
1 21
1 22
1 22
1 23
1 23
1 25
1 25
1 26
1 27
1 28
1 28
1 29
1 29
1 30
1 30
1 31
1 31
1 32
1 32
1 34
1 34
1 35
1 35
1 36
1 37
1 37
1 38
1 38
1 3...

result:

ok 

Test #77:

score: 55
Accepted
time: 0ms
memory: 3736kb

input:

43 6
3
30
31
28
30
32
2
25
24
26
28
29
1
30
25
23
25
24
5
32
22
29
22
28
5
35
28
22
28
30
3
32
24
27
25
25
4
0
30
29
26
16
2

output:

3562
1 1
1 1
1 1
1 1
1 1
1 4
1 7
1 7
1 7
1 7
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 13
1 13
1 13
1 13
1 15
1 16
1 16
1 17
1 18
1 19
1 19
1 19
1 19
1 19
1 21
1 21
1 22
1 23
1 23
1 24
1 25
1 25
1 25
1 25
1 25
1 27
1 28
1 28
1 29
1 31
1 31
1 31
1 31
1 31
1 33
1 34
1 35
1 36
1 37
1 37
1 37
1 37
1 37
1 38
1 3...

result:

ok 

Test #78:

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

input:

45 13
28
0
35
30
27
28
29
19
26
28
26
31
33
35
38
33
28
29
38
24
33
32
25
29
28
28
30
42
26
33
36
30
29
30
24
29
27
23
21
28
41
27
30
29
25

output:

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

result:

ok 

Test #79:

score: 55
Accepted
time: 1ms
memory: 3660kb

input:

46 20
31
28
32
33
31
32
13
12
12
13
8
13
0
7
13
7
10
12
14
5
31
32
32
29
36
32
7
8
8
7
12
7
20
13
7
13
10
8
6
15
34
36
32
34
29
32

output:

2846
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 27
1 28
1 29
1 30
1 31
1 32
1 34
1 35
1 36
1 37
1 38
1 39
1 40
2 20
2 20
2 20
2 20
2 20
2 20
2 20
2 20
2 20
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 10
1 10
1 11
1 11
1 12
1 12
1 13
1 13
1 14
1...

result:

ok 

Test #80:

score: 55
Accepted
time: 1ms
memory: 3728kb

input:

47 18
33
29
35
27
37
30
31
30
0
29
31
17
19
18
22
17
21
22
30
33
28
36
29
30
29
34
48
33
31
24
22
23
19
24
20
19
32
33
32
32
29
35
35
31
47
33
33

output:

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

result:

ok 

Test #81:

score: 55
Accepted
time: 1ms
memory: 3760kb

input:

48 7
31
42
38
43
36
36
14
35
39
37
41
31
33
11
40
33
32
41
40
42
8
40
33
37
44
38
33
10
38
34
37
43
32
36
12
34
33
38
41
37
32
11
35
39
34
0
39
41

output:

4464
1 1
1 1
1 3
1 5
1 6
1 7
1 7
1 7
1 7
1 8
1 9
1 10
1 11
1 12
1 12
1 13
1 13
1 14
1 14
1 14
1 14
1 14
1 15
1 16
1 16
1 17
1 17
1 18
1 19
1 21
1 21
1 21
1 21
1 21
1 22
1 23
1 23
1 24
1 26
1 27
1 27
1 28
1 28
1 28
1 28
1 28
1 29
1 30
1 30
1 31
1 33
1 33
1 34
1 35
1 35
1 35
1 35
1 35
1 36
1 36
1 37
1...

result:

ok 

Test #82:

score: 55
Accepted
time: 1ms
memory: 3736kb

input:

49 3
26
43
45
31
41
48
31
47
46
33
45
46
32
40
48
34
44
47
33
46
45
35
45
48
34
45
48
38
47
0
31
46
44
38
40
49
31
44
44
29
41
48
28
42
47
28
45
48
38

output:

4184
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 2
1 2
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 7
1 7
1 7
1 7
1 7
1 7
1 8
1 9
1 10
1 10
1 10
1 10
1 10
1 11
1 12
1 13
1 13
1 13
1 13
1 13
1 13
1 14
1 14
1 14
1 16
1 16
1 16
1 16
1 16
1 17
1 17
1 18
1 19
1 19
1 19
1 19
1 19
1 20
1 21
1 22
1 22
1 22
1 22
1 22
1 2...

result:

ok 

Test #83:

score: 55
Accepted
time: 1ms
memory: 3708kb

input:

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

output:

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

result:

ok 

Test #84:

score: 55
Accepted
time: 0ms
memory: 3676kb

input:

50 49
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
11

output:

226
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 50
1 50
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 8
1 8
1 9
1 9
1 10
1 10
1 11
1 11
1 12
1 12
1 13
1 13
1 14
1 14
1 15
1 15
1 16
1 16
1 17
1 17
1 18
1 18
1 19
1 19
1 20
1 20
1 21
1 21
1 22
1 22
1 23
1 23
1 24
1 24
1 25
1 25
1 26
1 26
...

result:

ok 

Test #85:

score: 55
Accepted
time: 0ms
memory: 3720kb

input:

50 3
0
0
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1

output:

-1

result:

ok 

Test #86:

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

input:

49 5
1
1
1
1
0
6
11
46
34
0
6
11
46
34
0
6
11
46
34
0
6
11
46
34
0
6
11
46
34
0
6
11
46
34
0
6
11
46
34
0
6
11
46
34
0
6
11
46
34

output:

-1

result:

ok 

Test #87:

score: 55
Accepted
time: 1ms
memory: 3780kb

input:

50 24
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
49
0
49
0
49
0
49
0
49
0
49
0
49
0
49
0
49
0
49
0
49
0
49

output:

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

result:

ok 

Test #88:

score: 55
Accepted
time: 0ms
memory: 3600kb

input:

50 47
1
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

output:

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

result:

ok 

Test #89:

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

input:

6 5
0
1
1
1
1
7

output:

29
1 1
1 2
1 3
1 4
1 5
2 1
1 6
1 6
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
1 5
1 5
2 2
2 2
2 2
2 2
1 1
1 1
1 2
1 3
1 4
1 5
1 6

result:

ok 

Test #90:

score: 55
Accepted
time: 0ms
memory: 3724kb

input:

7 3
1
2
3
0
6
5
7

output:

83
1 1
1 1
1 2
1 2
1 3
1 4
1 4
1 6
2 3
2 3
1 1
1 1
1 2
1 2
1 6
1 6
1 7
1 7
1 1
1 3
1 3
1 4
1 4
1 5
1 5
1 7
2 4
2 4
1 1
1 1
1 2
1 2
1 3
1 3
1 7
1 7
1 2
1 3
1 4
1 4
1 5
1 5
1 6
1 6
2 1
2 1
1 4
1 4
1 5
1 5
1 6
1 6
1 7
1 7
1 1
1 2
1 3
2 2
2 2
1 1
1 1
1 5
1 5
1 6
1 6
1 7
1 7
1 2
1 3
1 4
2 5
2 5
1 1
1 1
1...

result:

ok 

Test #91:

score: 55
Accepted
time: 0ms
memory: 3640kb

input:

6 4
2
1
0
4
1
50

output:

98
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 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
2 1
1 5
1 5
1 6
1 6
1 1
1 1
1 2
1 2
1 3
1 3
1 4
1 4
2 2
1 1
1...

result:

ok 

Test #92:

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

input:

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

output:

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

result:

ok 

Extra Test:

score: 0
Extra Test Passed