QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#828297#8435. Empty VesselsRong7AC ✓6ms4640kbC++171.5kb2024-12-23 15:40:152024-12-23 15:40:17

Judging History

This is the latest submission verdict.

  • [2024-12-23 15:40:17]
  • Judged
  • Verdict: AC
  • Time: 6ms
  • Memory: 4640kb
  • [2024-12-23 15:40:15]
  • Submitted

answer

// by saubguiu a normal one.

#include <bits/stdc++.h>
using namespace std;

#define inline __inline__ __attribute__ ((always_inline))

inline void o_1 (int x){ printf ("1 %d\n", x); } // fill
inline void o_2 (int x){ printf ("2 %d\n", x); } // pour out
inline void o_3 (int x, int y){ printf ("3 %d %d\n", x, y); }

const int N = 10, V = 2e4;
int n, A, a[N + 5], I, pre[V + 5];

signed main (){
    scanf ("%d%d", &n, &A);
    int w = 0;
    for (int i = 1;i <= n;++ i){
        scanf ("%d", &a[i]);
        if (a[i] > a[I]) I = i;
        if (w == 0) w = a[i];
        else w = __gcd (w, a[i]);
    }
    if (A > a[I] || A % w != 0) return puts ("-1"), 0;
    if (A == a[I]) return printf ("1\n1 %d\n", I), 0;
    pre[0] = 1;
    queue < int > Q; Q.push (0);
    while (! Q.empty ()){
        int u = Q.front (); Q.pop ();
        for (int i = 1;i <= n;++ i)
            if (i != I && ! pre[(u + a[i]) % a[I]]){
                pre[(u + a[i]) % a[I]] = i;
                Q.push ((u + a[i]) % a[I]);
            }
    }
    auto output = [] (auto self, int x, int cnt) -> void {
        if (! x) printf ("%d\n", cnt);
        else if (a[pre[x]] <= x){
            self (self, x - a[pre[x]], cnt + 2);
            o_1 (pre[x]), o_3 (pre[x], I);
        } else {
            self (self, x + a[I] - a[pre[x]], cnt + 4);
            o_1 (pre[x]), o_3 (pre[x], I);
            o_2 (I), o_3 (pre[x], I);
        }
        return void ();
    };
    output (output, A, 0);

    return 0;
}

詳細信息

Test #1:

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

input:

2 1
5 2

output:

8
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1

result:

ok OK

Test #2:

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

input:

4 3
1 2 1 1

output:

-1

result:

ok OK

Test #3:

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

input:

1 1
1

output:

1
1 1

result:

ok OK

Test #4:

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

input:

1 3
1

output:

-1

result:

ok OK

Test #5:

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

input:

1 5
5

output:

1
1 1

result:

ok OK

Test #6:

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

input:

1 5
20

output:

-1

result:

ok OK

Test #7:

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

input:

2 2
21 13

output:

16
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1

result:

ok OK

Test #8:

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

input:

10 5
233 55 89 144 8 13 21 34 377 610

output:

14
1 1
3 1 10
1 1
3 1 10
1 3
3 3 10
1 6
3 6 10
1 6
3 6 10
1 8
3 8 10
2 10
3 8 10

result:

ok OK

Test #9:

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

input:

2 4
20000 19999

output:

79982
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
...

result:

ok OK

Test #10:

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

input:

2 5
20000 19999

output:

79978
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
...

result:

ok OK

Test #11:

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

input:

6 5
15015 10010 12012 17160 13650 18480

output:

70
1 1
3 1 6
1 2
3 2 6
2 6
3 2 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 5
3 5 6
2 6
3 5 6
1 5
3 5 6
2 6
3 5 6
1 5
3 5 6
1 5
3 5...

result:

ok OK

Test #12:

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

input:

7 5
20000 15015 10010 12012 17160 13650 18480

output:

36
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 5
3 5 1
2 1
3 5 1
1 5
3 5 1
2 1
3 5 1
1 6
3 6 1
2 1
3 6 1
1 7
3 7 1
2 1
3 7 1
1 7
3 7 1
2 1
3 7 1

result:

ok OK

Test #13:

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

input:

10 2
15015 10010 12012 17160 13650 18480 20000 20000 20000 20000

output:

20
1 2
3 2 7
1 2
3 2 7
2 7
3 2 7
1 3
3 3 7
1 4
3 4 7
2 7
3 4 7
1 4
3 4 7
2 7
3 4 7
1 5
3 5 7
2 7
3 5 7

result:

ok OK

Test #14:

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

input:

10 1
15015 10010 12012 17160 13650 18480 20000 20000 20000 20000

output:

62
1 1
3 1 7
1 1
3 1 7
2 7
3 1 7
1 1
3 1 7
2 7
3 1 7
1 1
3 1 7
2 7
3 1 7
1 1
3 1 7
1 1
3 1 7
2 7
3 1 7
1 1
3 1 7
2 7
3 1 7
1 3
3 3 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7
1 5
3 5 7
1 5
3 5 7
2 7
3 5 7
1 5
3 5 7
2 7
3 5 7
1 5
3 5 7
1 5
3 5 7
2 7
3 5 7
1 5
3 5 7
2 7
3 5 7
1 6
3 6 7
2 7
3 6 7
1 6
3 6...

result:

ok OK

Test #15:

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

input:

10 3
15015 10010 12012 17160 13650 18480 20000 20000 20000 20000

output:

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

result:

ok OK

Test #16:

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

input:

10 4
15015 10010 12012 17160 13650 18480 20000 20000 20000 20000

output:

38
1 1
3 1 7
1 1
3 1 7
2 7
3 1 7
1 2
3 2 7
2 7
3 2 7
1 3
3 3 7
1 3
3 3 7
2 7
3 3 7
1 4
3 4 7
2 7
3 4 7
1 4
3 4 7
1 4
3 4 7
2 7
3 4 7
1 4
3 4 7
2 7
3 4 7
1 5
3 5 7
2 7
3 5 7
1 5
3 5 7
2 7
3 5 7

result:

ok OK

Test #17:

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

input:

10 5
15015 10010 12012 17160 13650 18480 20000 20000 20000 20000

output:

36
1 1
3 1 7
1 1
3 1 7
2 7
3 1 7
1 1
3 1 7
2 7
3 1 7
1 1
3 1 7
2 7
3 1 7
1 1
3 1 7
1 4
3 4 7
2 7
3 4 7
1 4
3 4 7
2 7
3 4 7
1 5
3 5 7
2 7
3 5 7
1 6
3 6 7
2 7
3 6 7
1 6
3 6 7
2 7
3 6 7

result:

ok OK

Test #18:

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

input:

5 5
1 1 1 1 1

output:

-1

result:

ok OK

Test #19:

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

input:

7 1
2 3 4 5 6 7 8

output:

6
1 1
3 1 7
1 6
3 6 7
2 7
3 6 7

result:

ok OK

Test #20:

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

input:

10 5
20000 1 1 1 1 1 1 1 1 1

output:

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

result:

ok OK

Test #21:

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

input:

2 1
19997 19993

output:

19994
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
...

result:

ok OK

Test #22:

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

input:

4 5
19759 19753 19079 19997

output:

94
1 1
3 1 4
1 1
3 1 4
2 4
3 1 4
1 1
3 1 4
2 4
3 1 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3...

result:

ok OK

Test #23:

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

input:

4 3
1998 20000 20000 1998

output:

-1

result:

ok OK

Test #24:

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

input:

4 4
12222 20000 20000 1998

output:

544
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 ...

result:

ok OK

Test #25:

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

input:

2 2
1 1

output:

-1

result:

ok OK

Test #26:

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

input:

2 5
15 3

output:

-1

result:

ok OK

Test #27:

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

input:

10 5
2 2 2 2 2 2 2 2 10 19999

output:

4006
1 1
3 1 10
1 1
3 1 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 10
1 9
3 9 1...

result:

ok OK

Test #28:

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

input:

3 3
1 2 3

output:

1
1 3

result:

ok OK

Test #29:

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

input:

8 2
159 357 456 789 123 321 654 987

output:

-1

result:

ok OK

Test #30:

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

input:

2 4
88 14

output:

88
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2...

result:

ok OK

Test #31:

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

input:

10 4
20000 20000 20000 20000 20000 20000 20000 20000 20000 20000

output:

-1

result:

ok OK

Test #32:

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

input:

10 5
20000 20000 20000 20000 20000 19999 20000 20000 20000 20000

output:

79978
1 6
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
...

result:

ok OK

Test #33:

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

input:

10 1
42 5 47 43 20 33 7 16 33 34

output:

6
1 2
3 2 3
1 4
3 4 3
2 3
3 4 3

result:

ok OK

Test #34:

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

input:

10 2
36 9 25 43 43 16 41 30 16 35

output:

6
1 1
3 1 4
1 2
3 2 4
2 4
3 2 4

result:

ok OK

Test #35:

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

input:

10 3
39 17 6 46 20 42 33 39 48 25

output:

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

result:

ok OK

Test #36:

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

input:

10 4
29 12 26 8 39 25 17 44 30 18

output:

6
1 9
3 9 8
1 10
3 10 8
2 8
3 10 8

result:

ok OK

Test #37:

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

input:

10 5
23 16 7 11 12 4 5 50 8 8

output:

2
1 7
3 7 8

result:

ok OK

Test #38:

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

input:

10 1
30 30 45 45 15015 10010 6006 4290 2730 2310

output:

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

result:

ok OK

Test #39:

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

input:

10 2
50 43 43 48 15015 10010 6006 4290 2730 2310

output:

20
1 1
3 1 5
1 2
3 2 5
1 2
3 2 5
1 2
3 2 5
1 4
3 4 5
1 4
3 4 5
1 7
3 7 5
1 7
3 7 5
1 9
3 9 5
2 5
3 9 5

result:

ok OK

Test #40:

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

input:

10 3
27 27 45 36 15015 10010 6006 4290 2730 2310

output:

22
1 3
3 3 5
1 7
3 7 5
1 7
3 7 5
1 7
3 7 5
2 5
3 7 5
1 9
3 9 5
1 10
3 10 5
1 10
3 10 5
1 10
3 10 5
1 10
3 10 5
2 5
3 10 5

result:

ok OK

Test #41:

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

input:

10 4
48 36 36 36 15015 10010 6006 4290 2730 2310

output:

26
1 1
3 1 5
1 1
3 1 5
1 1
3 1 5
1 1
3 1 5
1 2
3 2 5
1 2
3 2 5
1 6
3 6 5
1 6
3 6 5
2 5
3 6 5
1 8
3 8 5
1 9
3 9 5
1 9
3 9 5
2 5
3 9 5

result:

ok OK

Test #42:

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

input:

10 5
44 28 48 48 15015 10010 6006 4290 2730 2310

output:

16
1 2
3 2 5
1 2
3 2 5
1 3
3 3 5
1 7
3 7 5
1 8
3 8 5
1 10
3 10 5
1 10
3 10 5
2 5
3 10 5

result:

ok OK

Test #43:

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

input:

1 1
5243

output:

-1

result:

ok OK

Test #44:

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

input:

1 2
1165

output:

-1

result:

ok OK

Test #45:

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

input:

1 3
1279

output:

-1

result:

ok OK

Test #46:

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

input:

1 4
4498

output:

-1

result:

ok OK

Test #47:

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

input:

1 5
7716

output:

-1

result:

ok OK

Test #48:

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

input:

2 1
7425 3756

output:

-1

result:

ok OK

Test #49:

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

input:

2 2
7539 116

output:

264
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 ...

result:

ok OK

Test #50:

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

input:

2 3
10757 19581

output:

4834
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3...

result:

ok OK

Test #51:

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

input:

2 4
13975 15941

output:

7304
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3...

result:

ok OK

Test #52:

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

input:

2 5
9898 813

output:

4374
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3...

result:

ok OK

Test #53:

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

input:

3 1
16902 13009 4212

output:

452
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 ...

result:

ok OK

Test #54:

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

input:

3 2
4312 5178 9901

output:

292
1 1
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 ...

result:

ok OK

Test #55:

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

input:

3 3
12939 8834 8293

output:

372
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 ...

result:

ok OK

Test #56:

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

input:

3 4
16157 1002 6686

output:

396
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
1 2
3 ...

result:

ok OK

Test #57:

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

input:

3 5
3567 17363 12375

output:

610
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 ...

result:

ok OK

Test #58:

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

input:

4 1
3276 9559 2989 12794

output:

82
1 1
3 1 4
1 1
3 1 4
1 1
3 1 4
1 1
3 1 4
2 4
3 1 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 3
3 3 4
1 3
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
1 3
3 3 4
1 3
3 3 4
1 3
3 3...

result:

ok OK

Test #59:

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

input:

4 2
6494 14431 8677 6787

output:

116
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 ...

result:

ok OK

Test #60:

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

input:

4 3
9712 18088 14366 779

output:

110
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 ...

result:

ok OK

Test #61:

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

input:

4 4
5635 10256 12759 18964

output:

116
1 1
3 1 4
1 1
3 1 4
1 1
3 1 4
1 1
3 1 4
2 4
3 1 4
1 1
3 1 4
1 1
3 1 4
1 1
3 1 4
2 4
3 1 4
1 1
3 1 4
1 1
3 1 4
1 1
3 1 4
1 1
3 1 4
2 4
3 1 4
1 1
3 1 4
1 1
3 1 4
1 1
3 1 4
2 4
3 1 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
1 2
3 2 4
2 4
3 ...

result:

ok OK

Test #62:

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

input:

4 5
13045 2424 15344 5661

output:

166
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 ...

result:

ok OK

Test #63:

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

input:

5 1
12753 14620 13253 8969 6385

output:

32
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 4
3 4 2
1 4
3 4 2
2 2
3 4 2
1 5
3 5 2
2 2
3 5 2

result:

ok OK

Test #64:

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

input:

5 2
15972 10981 11646 2962 5451

output:

46
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 4
3 4 1
1 4
3 4 1
1 4
3 4 1
1 4
3 4 1
1 4
3 4 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
1 4
3 4 1
1 4
3 4 1
1 4
3 4 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
1 4
3 4 1
1 4
3 4 1
1 5
3 5 1
2 1
3 5 1

result:

ok OK

Test #65:

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

input:

5 3
19190 15853 17335 16955 8710

output:

88
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 3
3 3 1
2 1
3 3 1
1 3
3 3 1
2 1
3 3 1
1 3
3 3 1
2 1
3 3 1
1 3
3 3 1
2 1
3 3 1
1 3
3 3 1
2 1
3 3 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
2 1
3 4 1
1 5
3 5 1
1 5
3 5...

result:

ok OK

Test #66:

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

input:

5 4
12008 19510 15728 3651 481

output:

62
1 1
3 1 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 5
3 5 2
1 5
3 5 2
1 5
3 5 2
1 5
3 5...

result:

ok OK

Test #67:

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

input:

5 5
15226 11678 1417 4940 16444

output:

70
1 1
3 1 5
1 2
3 2 5
2 5
3 2 5
1 2
3 2 5
2 5
3 2 5
1 2
3 2 5
2 5
3 2 5
1 2
3 2 5
1 2
3 2 5
2 5
3 2 5
1 3
3 3 5
1 3
3 3 5
1 3
3 3 5
1 3
3 3 5
1 3
3 3 5
1 3
3 3 5
1 3
3 3 5
2 5
3 3 5
1 3
3 3 5
1 3
3 3 5
1 3
3 3 5
1 3
3 3 5
1 3
3 3 5
1 3
3 3 5
1 4
3 4 5
1 4
3 4 5
2 5
3 4 5
1 4
3 4 5
1 4
3 4 5
1 4
3 4...

result:

ok OK

Test #68:

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

input:

6 1
14935 3874 12030 953 10373 6755

output:

14
1 3
3 3 1
1 3
3 3 1
2 1
3 3 1
1 5
3 5 1
2 1
3 5 1
1 5
3 5 1
2 1
3 5 1

result:

ok OK

Test #69:

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

input:

6 2
18153 16042 17719 14945 2143 2490

output:

22
1 2
3 2 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
2 1
3 4 1

result:

ok OK

Test #70:

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

input:

6 3
5564 12403 16112 1642 5402 1330

output:

34
1 1
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 2
3 2 3
1 4
3 4 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
1 4
3 4 3
1 4
3 4 3
1 4
3 4 3
1 5
3 5 3
1 6
3 6 3
1 6
3 6 3
1 6
3 6 3
2 3
3 6 3

result:

ok OK

Test #71:

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

input:

6 4
8782 4571 14505 2931 4469 17065

output:

18
1 1
3 1 6
1 3
3 3 6
2 6
3 3 6
1 3
3 3 6
2 6
3 3 6
1 5
3 5 6
1 5
3 5 6
1 5
3 5 6
2 6
3 5 6

result:

ok OK

Test #72:

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

input:

6 5
4704 932 193 9627 432 8608

output:

36
1 3
3 3 4
1 5
3 5 4
1 5
3 5 4
1 5
3 5 4
1 5
3 5 4
1 5
3 5 4
1 5
3 5 4
1 5
3 5 4
1 5
3 5 4
1 5
3 5 4
1 6
3 6 4
2 4
3 6 4
1 6
3 6 4
2 4
3 6 4
1 6
3 6 4
2 4
3 6 4
1 6
3 6 4
2 4
3 6 4

result:

ok OK

Test #73:

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

input:

7 1
4413 8935 10807 12936 14361 911 18116

output:

26
1 1
3 1 7
1 1
3 1 7
1 1
3 1 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
1 2
3 2 7
2 7
3 2 7
1 3
3 3 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7

result:

ok OK

Test #74:

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

input:

7 2
11823 5296 16496 3825 13427 16646 19662

output:

34
1 2
3 2 7
1 2
3 2 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
1 3
3 3 7
2 7
3 3 7
1 4
3 4 7
1 4
3 4 7
2 7
3 4 7
1 4
3 4 7
1 5
3 5 7
2 7
3 5 7

result:

ok OK

Test #75:

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

input:

7 3
15041 17464 14889 5113 9390 8189 8503

output:

34
1 4
3 4 2
1 4
3 4 2
1 4
3 4 2
1 4
3 4 2
2 2
3 4 2
1 4
3 4 2
1 4
3 4 2
1 4
3 4 2
2 2
3 4 2
1 4
3 4 2
1 4
3 4 2
1 4
3 4 2
1 4
3 4 2
2 2
3 4 2
1 4
3 4 2
1 7
3 7 2
2 2
3 7 2

result:

ok OK

Test #76:

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

input:

7 4
10963 1121 577 11810 8457 19733 17345

output:

40
1 1
3 1 6
1 1
3 1 6
2 6
3 1 6
1 1
3 1 6
1 1
3 1 6
2 6
3 1 6
1 1
3 1 6
1 1
3 1 6
2 6
3 1 6
1 1
3 1 6
1 2
3 2 6
1 3
3 3 6
1 3
3 3 6
2 6
3 3 6
1 3
3 3 6
1 3
3 3 6
1 3
3 3 6
1 3
3 3 6
1 7
3 7 6
2 6
3 7 6

result:

ok OK

Test #77:

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

input:

7 5
14182 5993 10458 5803 11716 2764 6186

output:

38
1 2
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 3
3 3 1
2 1
3 3 1
1 4
3 4 1
1 4
3 4 1
1 5
3 5 1
2 1
3 5 1
1 5
3 5 1
2 1
3 5 1
1 5
3 5 1
2 1
3 5 1
1 5
3 5 1
2 1
3 5 1
1 7
3 7 1
1 7
3 7 1
2 1
3 7 1

result:

ok OK

Test #78:

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

input:

8 1
18082 18189 1072 1815 11053 7770 15003 18755

output:

12
1 3
3 3 8
1 3
3 3 8
1 3
3 3 8
1 6
3 6 8
1 6
3 6 8
2 8
3 6 8

result:

ok OK

Test #79:

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

input:

8 2
14005 14549 6761 3104 14311 3505 3844 2065

output:

46
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 7
3 7 2
2 2
3 7 2

result:

ok OK

Test #80:

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

input:

8 3
17223 6718 17857 9801 13378 15049 12685 12671

output:

40
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 5
3 5 3
2 3
3 5 3
1 6
3 6 3
2 3
3 6 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
1 7
3 7 3
2 3
3 7 3
1 8
3 8 3
2 3
3 8 3
1 8
3 8 3
2 3
3 8 3

result:

ok OK

Test #81:

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

input:

8 4
441 10374 3546 3793 5149 6592 1527 11789

output:

26
1 1
3 1 8
1 1
3 1 8
1 1
3 1 8
1 1
3 1 8
1 1
3 1 8
1 1
3 1 8
1 3
3 3 8
1 3
3 3 8
1 3
3 3 8
2 8
3 3 8
1 5
3 5 8
1 5
3 5 8
2 8
3 5 8

result:

ok OK

Test #82:

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

input:

8 5
7851 2543 9235 5082 8408 2327 3072 15100

output:

22
1 2
3 2 8
1 2
3 2 8
1 2
3 2 8
1 2
3 2 8
1 3
3 3 8
2 8
3 3 8
1 6
3 6 8
1 6
3 6 8
1 7
3 7 8
1 7
3 7 8
2 8
3 7 8

result:

ok OK

Test #83:

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

input:

9 1
264 7443 19849 1095 2337 1925 6481 11898 16736

output:

26
1 4
3 4 3
1 4
3 4 3
1 4
3 4 3
1 4
3 4 3
1 4
3 4 3
1 7
3 7 3
1 8
3 8 3
2 3
3 8 3
1 8
3 8 3
1 8
3 8 3
2 3
3 8 3
1 8
3 8 3
2 3
3 8 3

result:

ok OK

Test #84:

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

input:

9 2
3482 19611 5537 7791 18299 13469 15322 2505 10843

output:

28
1 4
3 4 2
1 4
3 4 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 8
3 8 2
1 9
3 9 2
2 2
3 9 2
1 9
3 9 2
1 9
3 9 2
2 2
3 9 2
1 9
3 9 2
2 2
3 9 2

result:

ok OK

Test #85:

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

input:

9 3
6700 15971 3930 5976 17366 9204 16868 13111 17654

output:

26
1 2
3 2 9
1 2
3 2 9
2 9
3 2 9
1 2
3 2 9
2 9
3 2 9
1 2
3 2 9
2 9
3 2 9
1 2
3 2 9
2 9
3 2 9
1 6
3 6 9
2 9
3 6 9
1 7
3 7 9
2 9
3 7 9

result:

ok OK

Test #86:

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

input:

9 4
6815 15436 9619 7265 16433 748 5709 12229 8657

output:

24
1 1
3 1 5
1 1
3 1 5
1 1
3 1 5
2 5
3 1 5
1 1
3 1 5
1 3
3 3 5
2 5
3 3 5
1 3
3 3 5
1 3
3 3 5
2 5
3 3 5
1 3
3 3 5
2 5
3 3 5

result:

ok OK

Test #87:

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

input:

9 5
10033 11796 8012 13961 12396 16483 14550 15539 15468

output:

34
1 1
3 1 6
1 1
3 1 6
2 6
3 1 6
1 1
3 1 6
1 1
3 1 6
2 6
3 1 6
1 2
3 2 6
2 6
3 2 6
1 2
3 2 6
1 3
3 3 6
2 6
3 3 6
1 7
3 7 6
2 6
3 7 6
1 7
3 7 6
2 6
3 7 6
1 7
3 7 6
2 6
3 7 6

result:

ok OK

Test #88:

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

input:

10 1
3340 6069 11033 9735 10137 1053 4378 10299 19078 4262

output:

20
1 1
3 1 9
1 2
3 2 9
1 6
3 6 9
1 7
3 7 9
1 7
3 7 9
2 9
3 7 9
1 7
3 7 9
1 8
3 8 9
1 10
3 10 9
2 9
3 10 9

result:

ok OK

Test #89:

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

input:

10 2
6558 2429 9425 3728 1907 16788 10115 9418 10081 7227

output:

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

result:

ok OK

Test #90:

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

input:

10 3
9777 14598 15114 17721 17870 8332 18956 12728 16892 10191

output:

24
1 1
3 1 7
1 1
3 1 7
2 7
3 1 7
1 1
3 1 7
1 2
3 2 7
2 7
3 2 7
1 3
3 3 7
2 7
3 3 7
1 5
3 5 7
2 7
3 5 7
1 5
3 5 7
2 7
3 5 7

result:

ok OK

Test #91:

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

input:

10 4
12995 18254 803 15905 16937 4067 7798 16038 7895 10051

output:

28
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 5
3 5 2
2 2
3 5 2
1 9
3 9 2
1 9
3 9 2
2 2
3 9 2

result:

ok OK

Test #92:

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

input:

10 5
13109 3126 19196 9898 8708 15611 9343 15156 14706 13016

output:

28
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 2
3 2 3
1 4
3 4 3
2 3
3 4 3
1 5
3 5 3
1 5
3 5 3
2 3
3 5 3

result:

ok OK

Test #93:

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

input:

1 1
19212

output:

-1

result:

ok OK

Test #94:

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

input:

1 2
13297

output:

-1

result:

ok OK

Test #95:

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

input:

1 3
19661

output:

-1

result:

ok OK

Test #96:

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

input:

1 4
18789

output:

-1

result:

ok OK

Test #97:

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

input:

1 5
18757

output:

-1

result:

ok OK

Test #98:

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

input:

2 1
13347 17006

output:

39984
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
...

result:

ok OK

Test #99:

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

input:

2 2
15306 17398

output:

30234
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
...

result:

ok OK

Test #100:

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

input:

2 3
16098 17726

output:

-1

result:

ok OK

Test #101:

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

input:

2 4
16602 12658

output:

21396
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
...

result:

ok OK

Test #102:

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

input:

2 5
10239 17194

output:

24810
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
...

result:

ok OK

Test #103:

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

input:

3 1
15315 16540 18210

output:

-1

result:

ok OK

Test #104:

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

input:

3 2
15270 15110 10632

output:

586
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 ...

result:

ok OK

Test #105:

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

input:

3 3
18585 19590 10338

output:

122
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 ...

result:

ok OK

Test #106:

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

input:

3 4
13605 13220 14334

output:

1182
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3...

result:

ok OK

Test #107:

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

input:

3 5
18405 12970 12732

output:

508
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
1 2
3 2 1
2 1
3 ...

result:

ok OK

Test #108:

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

input:

4 1
10185 16730 11046 19830

output:

118
1 1
3 1 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 ...

result:

ok OK

Test #109:

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

input:

4 2
10395 15260 13944 18930

output:

94
1 1
3 1 4
1 1
3 1 4
2 4
3 1 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3...

result:

ok OK

Test #110:

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

input:

4 3
11235 17990 13188 13980

output:

144
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 3
3 3 2
2 2
3 3 2
1 4
3 ...

result:

ok OK

Test #111:

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

input:

4 4
13860 12950 19110 18030

output:

-1

result:

ok OK

Test #112:

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

input:

4 5
11130 12670 19236 11010

output:

-1

result:

ok OK

Test #113:

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

input:

5 1
15015 17710 14322 12870 15540

output:

88
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 4
3 4 2
2 2
3 4 2
1 4
3 4...

result:

ok OK

Test #114:

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

input:

5 2
16170 10010 10626 13860 15540

output:

-1

result:

ok OK

Test #115:

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

input:

5 3
15015 16170 12012 12210 15960

output:

98
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 1
3 1 2
2 2
3 1 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
1 3
3 3 2
2 2
3 3 2
1 3
3 3 2
2 2
3 3 2
1 4
3 4 2
2 2
3 4 2
1 4
3 4 2
1 4
3 4 2
2 2
3 4 2
1 4
3 4...

result:

ok OK

Test #116:

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

input:

5 4
16170 14630 13398 18150 14070

output:

80
1 1
3 1 4
1 1
3 1 4
2 4
3 1 4
1 1
3 1 4
2 4
3 1 4
1 1
3 1 4
2 4
3 1 4
1 1
3 1 4
2 4
3 1 4
1 1
3 1 4
2 4
3 1 4
1 1
3 1 4
2 4
3 1 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
2 4
3 2 4
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3...

result:

ok OK

Test #117:

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

input:

5 5
15015 13090 15246 13860 19320

output:

-1

result:

ok OK

Test #118:

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

input:

6 1
15015 10010 18018 17160 13650 13860

output:

104
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 2
3 2 3
1 2
3 2 3
2 3
3 2 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
2 3
3 4 3
1 5
3 5 3
1 5
3 5 3
2 3
3 5 3
1 5
3 5 3
2 3
3 5 3
1 5
3 5 3
2 3
3 5 3
1 5
3 ...

result:

ok OK

Test #119:

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

input:

6 2
15015 10010 12012 17160 16380 13860

output:

18
1 2
3 2 4
1 3
3 3 4
2 4
3 3 4
1 5
3 5 4
2 4
3 5 4
1 5
3 5 4
2 4
3 5 4
1 6
3 6 4
2 4
3 6 4

result:

ok OK

Test #120:

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

input:

6 3
15015 10010 18018 12870 16380 13860

output:

64
1 1
3 1 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
2 3
3 4 3
1 5
3 5 3
2 3
3 5 3
1 5
3 5 3
1 5
3 5 3
2 3
3 5 3
1 6
3 6 3
2 3
3 6 3
1 6
3 6 3
2 3
3 6 3
1 6
3 6 3
2 3
3 6 3
1 6
3 6 3
1 6
3 6 3
2 3
3 6 3
1 6
3 6 3
2 3
3 6 3
1 6
3 6 3
2 3
3 6...

result:

ok OK

Test #121:

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

input:

6 4
15015 10010 12012 17160 16380 13860

output:

36
1 2
3 2 4
1 2
3 2 4
2 4
3 2 4
1 3
3 3 4
1 3
3 3 4
2 4
3 3 4
1 5
3 5 4
2 4
3 5 4
1 5
3 5 4
2 4
3 5 4
1 5
3 5 4
2 4
3 5 4
1 5
3 5 4
2 4
3 5 4
1 6
3 6 4
2 4
3 6 4
1 6
3 6 4
2 4
3 6 4

result:

ok OK

Test #122:

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

input:

6 5
15015 10010 12012 17160 19110 16170

output:

58
1 1
3 1 5
1 1
3 1 5
2 5
3 1 5
1 1
3 1 5
2 5
3 1 5
1 1
3 1 5
2 5
3 1 5
1 1
3 1 5
1 1
3 1 5
2 5
3 1 5
1 1
3 1 5
2 5
3 1 5
1 2
3 2 5
2 5
3 2 5
1 4
3 4 5
1 4
3 4 5
2 5
3 4 5
1 4
3 4 5
2 5
3 4 5
1 4
3 4 5
2 5
3 4 5
1 6
3 6 5
2 5
3 6 5
1 6
3 6 5
2 5
3 6 5
1 6
3 6 5
2 5
3 6 5
1 6
3 6 5
2 5
3 6 5

result:

ok OK

Test #123:

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

input:

7 1
16416 15015 10010 18018 17160 19110 11550

output:

56
1 1
3 1 6
1 2
3 2 6
2 6
3 2 6
1 2
3 2 6
2 6
3 2 6
1 2
3 2 6
2 6
3 2 6
1 3
3 3 6
1 3
3 3 6
2 6
3 3 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
2 6
3 4 6
1 4
3 4 6
1 7
3 7 6
2 6
3 7 6
1 7
3 7 6
2 6
3 7 6
1 7
3 7 6
1 7
3 7 6
2 6
3 7 6
1 7
3 7 6
2 6
3 7 6

result:

ok OK

Test #124:

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

input:

7 2
16632 15015 10010 12012 17160 16380 16170

output:

46
1 1
3 1 5
1 1
3 1 5
2 5
3 1 5
1 1
3 1 5
2 5
3 1 5
1 1
3 1 5
2 5
3 1 5
1 1
3 1 5
2 5
3 1 5
1 1
3 1 5
2 5
3 1 5
1 2
3 2 5
2 5
3 2 5
1 2
3 2 5
2 5
3 2 5
1 3
3 3 5
2 5
3 3 5
1 6
3 6 5
2 5
3 6 5
1 6
3 6 5
2 5
3 6 5
1 7
3 7 5
2 5
3 7 5

result:

ok OK

Test #125:

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

input:

7 3
11553 15015 10010 12012 12870 10920 16170

output:

42
1 1
3 1 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
2 7
3 2 7
1 2
3 2 7
2 7
3 2 7

result:

ok OK

Test #126:

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

input:

7 4
14508 15015 10010 18018 17160 16380 13860

output:

36
1 1
3 1 4
1 3
3 3 4
2 4
3 3 4
1 3
3 3 4
1 6
3 6 4
2 4
3 6 4
1 6
3 6 4
2 4
3 6 4
1 6
3 6 4
2 4
3 6 4
1 6
3 6 4
2 4
3 6 4
1 6
3 6 4
2 4
3 6 4
1 7
3 7 4
2 4
3 7 4
1 7
3 7 4
2 4
3 7 4

result:

ok OK

Test #127:

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

input:

7 5
11898 15015 10010 12012 12870 19110 13860

output:

38
1 1
3 1 6
1 2
3 2 6
2 6
3 2 6
1 2
3 2 6
2 6
3 2 6
1 2
3 2 6
1 2
3 2 6
2 6
3 2 6
1 2
3 2 6
2 6
3 2 6
1 2
3 2 6
2 6
3 2 6
1 2
3 2 6
2 6
3 2 6
1 3
3 3 6
1 4
3 4 6
2 6
3 4 6
1 7
3 7 6
2 6
3 7 6

result:

ok OK

Test #128:

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

input:

8 1
11781 11781 15015 10010 12012 12870 13650 11550

output:

70
1 1
3 1 3
1 4
3 4 3
2 3
3 4 3
1 4
3 4 3
2 3
3 4 3
1 6
3 6 3
1 6
3 6 3
2 3
3 6 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
2 3
3 7 3
1 7
3 7 3
1 8
3 8 3
2 3
3 8 3
1 8
3 8...

result:

ok OK

Test #129:

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

input:

8 2
18604 18604 15015 10010 18018 17160 16380 13860

output:

48
1 3
3 3 1
1 3
3 3 1
2 1
3 3 1
1 4
3 4 1
2 1
3 4 1
1 4
3 4 1
1 5
3 5 1
2 1
3 5 1
1 5
3 5 1
2 1
3 5 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 7
3 7 1
2 1
3 7 1
1 7
3 7 1
2 1
3 7 1

result:

ok OK

Test #130:

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

input:

8 3
15072 10048 15015 10010 18018 17160 13650 11550

output:

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

result:

ok OK

Test #131:

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

input:

8 4
19060 14295 15015 10010 12012 17160 13650 11550

output:

46
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 3
3 3 1
2 1
3 3 1
1 3
3 3 1
1 3
3 3 1
2 1
3 3 1
1 4
3 4 1
2 1
3 4 1
1 5
3 5 1
1 5
3 5 1
2 1
3 5 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1
1 6
3 6 1
2 1
3 6 1

result:

ok OK

Test #132:

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

input:

8 5
11193 19188 15015 10010 12012 12870 19110 18480

output:

62
1 1
3 1 2
1 4
3 4 2
2 2
3 4 2
1 5
3 5 2
1 5
3 5 2
2 2
3 5 2
1 6
3 6 2
2 2
3 6 2
1 6
3 6 2
1 6
3 6 2
2 2
3 6 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8...

result:

ok OK

Test #133:

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

input:

9 1
15688 11024 16112 15015 10010 12012 12870 19110 16170

output:

28
1 1
3 1 8
1 1
3 1 8
2 8
3 1 8
1 1
3 1 8
2 8
3 1 8
1 1
3 1 8
2 8
3 1 8
1 4
3 4 8
2 8
3 4 8
1 6
3 6 8
1 6
3 6 8
2 8
3 6 8
1 7
3 7 8
2 8
3 7 8

result:

ok OK

Test #134:

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

input:

9 2
15030 18036 15030 15015 10010 12012 17160 16380 13860

output:

14
1 5
3 5 2
1 8
3 8 2
2 2
3 8 2
1 9
3 9 2
2 2
3 9 2
1 9
3 9 2
2 2
3 9 2

result:

ok OK

Test #135:

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

input:

9 3
13590 13590 16610 15015 10010 12012 12870 10920 13860

output:

54
1 1
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 1
3 1 3
2 3
3 1 3
1 4
3 4 3
1 6
3 6 3
2 3
3 6 3
1 6
3 6 3
2 3
3 6 3
1 6
3 6 3
2 3
3 6 3
1 6
3 6 3
1 7
3 7 3
2 3
3 7 3
1 9
3 9 3
2 3
3 9 3
1 9
3 9 3
2 3
3 9 3
1 9
3 9 3
2 3
3 9 3
1 9
3 9 3
2 3
3 9 3

result:

ok OK

Test #136:

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

input:

9 4
12402 12402 16536 15015 10010 12012 17160 13650 11550

output:

54
1 1
3 1 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7
1 3
3 3 7
2 7
3 3 7
1 5
3 5 7
2 7
3 5 7
1 5
3 5 7
1 9
3 9 7
2 7
3 9 7
1 9
3 9 7
1 9
3 9 7
2 7
3 9 7
1 9
3 9 7
2 7
3 9 7
1 9
3 9 7
2 7
3 9 7

result:

ok OK

Test #137:

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

input:

9 5
18306 17967 13560 15015 10010 18018 17160 16380 16170

output:

38
1 2
3 2 1
1 2
3 2 1
2 1
3 2 1
1 2
3 2 1
2 1
3 2 1
1 5
3 5 1
2 1
3 5 1
1 6
3 6 1
2 1
3 6 1
1 7
3 7 1
2 1
3 7 1
1 7
3 7 1
2 1
3 7 1
1 9
3 9 1
2 1
3 9 1
1 9
3 9 1
2 1
3 9 1
1 9
3 9 1
2 1
3 9 1

result:

ok OK

Test #138:

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

input:

10 1
11922 19870 15896 11922 15015 10010 12012 12870 16380 13860

output:

36
1 1
3 1 2
1 1
3 1 2
2 2
3 1 2
1 5
3 5 2
1 6
3 6 2
2 2
3 6 2
1 7
3 7 2
2 2
3 7 2
1 8
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
2 2
3 8 2
1 8
3 8 2
1 8
3 8 2
2 2
3 8 2
1 10
3 10 2
2 2
3 10 2

result:

ok OK

Test #139:

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

input:

10 2
18428 18428 13821 18428 15015 10010 12012 17160 13650 16170

output:

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

result:

ok OK

Test #140:

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

input:

10 3
18450 15375 12300 18450 15015 10010 18018 12870 13650 13860

output:

32
1 2
3 2 1
1 7
3 7 1
2 1
3 7 1
1 9
3 9 1
2 1
3 9 1
1 9
3 9 1
2 1
3 9 1
1 9
3 9 1
2 1
3 9 1
1 9
3 9 1
1 9
3 9 1
2 1
3 9 1
1 9
3 9 1
2 1
3 9 1
1 10
3 10 1
2 1
3 10 1

result:

ok OK

Test #141:

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

input:

10 4
17205 17205 11470 11470 15015 10010 12012 17160 16380 11550

output:

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

result:

ok OK

Test #142:

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

input:

10 5
16812 16812 16812 12609 15015 10010 18018 12870 19110 16170

output:

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

result:

ok OK