QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#22558#2848. 城市地铁规划blackswallow#AC ✓21ms3972kbC++202.5kb2022-03-09 20:18:082022-04-30 01:20:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 01:20:28]
  • 评测
  • 测评结果:AC
  • 用时:21ms
  • 内存:3972kb
  • [2022-03-09 20:18:08]
  • 提交

answer

//Code By CXY07 - It's My Fiesta.
#include<bits/stdc++.h>
using namespace std;

//#define FILE
#define int long long
#define randint(l, r) (rand() % ((r) - (l) + 1) + (l))
#define abs(x) ((x) < 0 ? (-(x)) : (x))
#define popc(x) __builtin_popcount(x)
#define inv(x) qpow((x), mod - 2)
#define lowbit(x) ((x) & (-(x)))
#define ull unsigned long long
#define pii pair<int, int>
#define LL long long
#define mp make_pair
#define pb push_back
#define scd second
#define vec vector
#define fst first
#define endl '\n'
#define y1 _y1

const int MAXN = 6010;
const int INF = 2e9;
const double eps = 1e-6;
const double PI = acos(-1);
const int mod = 59393;
//const int mod = 998244353;
//const int G = 3;
//const int base = 131;

int n, k, m, Ans;
int dp[MAXN], a[15], coef[MAXN];
int pre[MAXN], d[MAXN];

template<typename T> inline bool read(T &a) {
	a = 0; char c = getchar(); int f = 1;
	while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar(); }
	while(c >= '0' && c <= '9') { a = a * 10 + (c ^ 48); c = getchar(); }
	return a *= f, true;
}

template<typename A, typename ...B>
inline bool read(A &x, B &...y) { return read(x) && read(y...); }

int f(int x) {
	int res = 0;
	for(int i = k; i >= 0; --i)
		res = (res * x + a[i]) % mod;
	return res;
}

void GetPrufer() {
	int t[MAXN], cnt = 0;
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= d[i]; ++j)
			t[++cnt] = i;
	priority_queue<int> Q; while(Q.size()) Q.pop();
	for(int i = 1; i <= n; ++i)
		if(!d[i]) Q.push(-i);
	for(int i = 1; i <= cnt; ++i) {
		int x = -Q.top(); Q.pop();
		printf("%lld %lld\n", x, t[i]);
		--d[t[i]];
		if(!d[t[i]]) Q.push(-t[i]);
	}
	assert((int)Q.size() == 2);
	printf("%lld ", -Q.top()); Q.pop();
	printf("%lld\n", -Q.top()); Q.pop();
}

signed main () {
#ifdef FILE
	freopen(".in", "r", stdin);
	freopen(".out", "w", stdout);
#endif
	read(n), read(k); m = n - 2;
	for(int i = 0; i <= k; ++i) read(a[i]);
	if(n == 1) {
		printf("0 %lld\n", a[0]);
		return 0;
	}
	int tmp = f(1); coef[0] = 0;
	for(int i = 1; i < n; ++i) 
		coef[i] = f(i + 1) - tmp;
	Ans += tmp * n;
	memset(dp, -0x3f, sizeof dp); dp[0] = 0;
	for(int i = 0; i <= m; ++i)
		for(int j = 1; j < n && i + j <= m; ++j)
			if(dp[i + j] < dp[i] + coef[j]) {
				dp[i + j] = dp[i] + coef[j];
				pre[i + j] = i;
			}
	Ans += dp[m];
	int p = 1, cur = m;
	while(cur) {
		d[p] += cur - pre[cur];
		cur = pre[cur]; ++p;
	}
	printf("%lld %lld\n", n - 1, Ans);
	if(n > 1) GetPrufer();
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 3716kb

input:

63 7
4 50 14 48 33 13 44 24

output:

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

result:

ok 

Test #2:

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

input:

208 7
23 28 14 16 46 28 26 28

output:

207 3317121
104 1
105 1
1 2
106 2
2 3
107 3
3 4
108 4
4 5
109 5
5 6
110 6
6 7
111 7
7 8
112 8
8 9
113 9
9 10
114 10
10 11
115 11
11 12
116 12
12 13
117 13
13 14
118 14
14 15
119 15
15 16
120 16
16 17
121 17
17 18
122 18
18 19
123 19
19 20
124 20
20 21
125 21
21 22
126 22
22 23
127 23
23 24
128 24
24...

result:

ok 

Test #3:

score: 0
Accepted
time: 21ms
memory: 3952kb

input:

2928 3
27 20 7 29

output:

2927 13889888
267 1
268 1
269 1
270 1
271 1
272 1
273 1
274 1
275 1
276 1
277 1
1 2
278 2
279 2
280 2
281 2
282 2
283 2
284 2
285 2
286 2
287 2
2 3
288 3
289 3
290 3
291 3
292 3
293 3
294 3
295 3
296 3
297 3
3 4
298 4
299 4
300 4
301 4
302 4
303 4
304 4
305 4
306 4
307 4
4 5
308 5
309 5
310 5
311 5
...

result:

ok 

Test #4:

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

input:

320 3
46 42 15 15

output:

319 1260206
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
1 2
38 2
39 2
40 2
41 2
42 2
43 2
44 2
45 2
46 2
47 2
48 2
49 2
50 2
2 3
51 3
52 3
53 3
54 3
55 3
56 3
57 3
58 3
59 3
60 3
61 3
62 3
63 3
3 4
64 4
65 4
66 4
67 4
68 4
69 4
70 4
71 4
72 4
73 4
74 4
75 4
76 4
4 5
77 5
78...

result:

ok 

Test #5:

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

input:

380 5
41 27 8 3 31 0

output:

379 3140470
77 1
78 1
79 1
80 1
81 1
1 2
82 2
83 2
84 2
85 2
2 3
86 3
87 3
88 3
89 3
3 4
90 4
91 4
92 4
93 4
4 5
94 5
95 5
96 5
97 5
5 6
98 6
99 6
100 6
101 6
6 7
102 7
103 7
104 7
105 7
7 8
106 8
107 8
108 8
109 8
8 9
110 9
111 9
112 9
113 9
9 10
114 10
115 10
116 10
117 10
10 11
118 11
119 11
120 ...

result:

ok 

Test #6:

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

input:

365 5
35 20 24 29 3 25

output:

364 3508667
122 1
123 1
124 1
1 2
125 2
126 2
2 3
127 3
128 3
3 4
129 4
130 4
4 5
131 5
132 5
5 6
133 6
134 6
6 7
135 7
136 7
7 8
137 8
138 8
8 9
139 9
140 9
9 10
141 10
142 10
10 11
143 11
144 11
11 12
145 12
146 12
12 13
147 13
148 13
13 14
149 14
150 14
14 15
151 15
152 15
15 16
153 16
154 16
16 ...

result:

ok 

Test #7:

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

input:

318 6
4 44 46 6 37 14 49

output:

317 6799456
159 1
160 1
1 2
161 2
2 3
162 3
3 4
163 4
4 5
164 5
5 6
165 6
6 7
166 7
7 8
167 8
8 9
168 9
9 10
169 10
10 11
170 11
11 12
171 12
12 13
172 13
13 14
173 14
14 15
174 15
15 16
175 16
16 17
176 17
17 18
177 18
18 19
178 19
19 20
179 20
20 21
180 21
21 22
181 22
22 23
182 23
23 24
183 24
24...

result:

ok 

Test #8:

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

input:

416 6
30 23 4 16 45 32 19

output:

415 5383994
208 1
209 1
1 2
210 2
2 3
211 3
3 4
212 4
4 5
213 5
5 6
214 6
6 7
215 7
7 8
216 8
8 9
217 9
9 10
218 10
10 11
219 11
11 12
220 12
12 13
221 13
13 14
222 14
14 15
223 15
15 16
224 16
16 17
225 17
17 18
226 18
18 19
227 19
19 20
228 20
20 21
229 21
21 22
230 22
22 23
231 23
23 24
232 24
24...

result:

ok 

Test #9:

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

input:

572 5
15 27 5 18 3 46

output:

571 9396678
191 1
192 1
193 1
1 2
194 2
195 2
2 3
196 3
197 3
3 4
198 4
199 4
4 5
200 5
201 5
5 6
202 6
203 6
6 7
204 7
205 7
7 8
206 8
207 8
8 9
208 9
209 9
9 10
210 10
211 10
10 11
212 11
213 11
11 12
214 12
215 12
12 13
216 13
217 13
13 14
218 14
219 14
14 15
220 15
221 15
15 16
222 16
223 16
16 ...

result:

ok 

Test #10:

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

input:

531 8
20 13 35 27 41 43 36 25 5

output:

530 9024252
178 1
179 1
180 1
1 2
181 2
182 2
2 3
183 3
184 3
3 4
185 4
186 4
4 5
187 5
188 5
5 6
189 6
190 6
6 7
191 7
192 7
7 8
193 8
194 8
8 9
195 9
196 9
9 10
197 10
198 10
10 11
199 11
200 11
11 12
201 12
202 12
12 13
203 13
204 13
13 14
205 14
206 14
14 15
207 15
208 15
15 16
209 16
210 16
16 ...

result:

ok 

Test #11:

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

input:

487 10
29 29 40 45 5 16 40 47 47 2 14

output:

486 18026623
486 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 5...

result:

ok 

Test #12:

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

input:

584 7
10 27 29 8 32 43 26 3

output:

583 11437238
292 1
293 1
1 2
294 2
2 3
295 3
3 4
296 4
4 5
297 5
5 6
298 6
6 7
299 7
7 8
300 8
8 9
301 9
9 10
302 10
10 11
303 11
11 12
304 12
12 13
305 13
13 14
306 14
14 15
307 15
15 16
308 16
16 17
309 17
17 18
310 18
18 19
311 19
19 20
312 20
20 21
313 21
21 22
314 22
22 23
315 23
23 24
316 24
2...

result:

ok 

Test #13:

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

input:

59 4
48 16 9 42 21

output:

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

result:

ok 

Test #14:

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

input:

561 3
22 31 17 49

output:

560 3223790
64 1
65 1
66 1
67 1
68 1
69 1
70 1
71 1
72 1
1 2
73 2
74 2
75 2
76 2
77 2
78 2
79 2
80 2
2 3
81 3
82 3
83 3
84 3
85 3
86 3
87 3
88 3
3 4
89 4
90 4
91 4
92 4
93 4
94 4
95 4
96 4
4 5
97 5
98 5
99 5
100 5
101 5
102 5
103 5
104 5
5 6
105 6
106 6
107 6
108 6
109 6
110 6
111 6
112 6
6 7
113 7
...

result:

ok 

Test #15:

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

input:

629 6
26 31 41 32 13 39 41

output:

628 13149156
315 1
316 1
1 2
317 2
2 3
318 3
3 4
319 4
4 5
320 5
5 6
321 6
6 7
322 7
7 8
323 8
8 9
324 9
9 10
325 10
10 11
326 11
11 12
327 12
12 13
328 13
13 14
329 14
14 15
330 15
15 16
331 16
16 17
332 17
17 18
333 18
18 19
334 19
19 20
335 20
20 21
336 21
21 22
337 22
22 23
338 23
23 24
339 24
2...

result:

ok 

Test #16:

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

input:

616 3
38 48 27 2

output:

615 1394108
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
1 2
51 2
52 2
53 2
54 2
55 2
56 2
57 2
58 2
59 2
60 2
61 2
62 2
63 2
64 2
65 2
66 2
67 2
68 2
69 2
70 2
71 2
72 2
73 2
74 2
2 3
75 3
76 3
77 3
78 3
79 3
80 3
81 3
...

result:

ok 

Test #17:

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

input:

744 2
49 45 50

output:

743 1425426
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
1 2
57 2
58 2
59 2
60 2
61 2
62 2
63 2
64 2
65 2
66 2
67 2
68 2
69 2
70 2
71 2
72 2
73 2
74 2
75 2
76 2
77 2
78 2
79 2
80 2...

result:

ok 

Test #18:

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

input:

629 7
27 18 48 24 37 38 6 3

output:

628 9258317
159 1
160 1
161 1
162 1
1 2
163 2
164 2
165 2
2 3
166 3
167 3
168 3
3 4
169 4
170 4
171 4
4 5
172 5
173 5
174 5
5 6
175 6
176 6
177 6
6 7
178 7
179 7
180 7
7 8
181 8
182 8
183 8
8 9
184 9
185 9
186 9
9 10
187 10
188 10
189 10
10 11
190 11
191 11
192 11
11 12
193 12
194 12
195 12
12 13
19...

result:

ok 

Test #19:

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

input:

602 8
17 25 14 13 2 16 23 24 44

output:

601 9947756
601 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...

result:

ok 

Test #20:

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

input:

900 2
9 13 12

output:

899 787522
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 1
65 1
66 1
67 1
68 1
69 1
70 1
71 1
72 1...

result:

ok 

Test #21:

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

input:

839 7
12 12 28 33 35 29 14 17

output:

838 24516016
420 1
421 1
1 2
422 2
2 3
423 3
3 4
424 4
4 5
425 5
5 6
426 6
6 7
427 7
7 8
428 8
8 9
429 9
9 10
430 10
10 11
431 11
11 12
432 12
12 13
433 13
13 14
434 14
14 15
435 15
15 16
436 16
16 17
437 17
17 18
438 18
18 19
439 19
19 20
440 20
20 21
441 21
21 22
442 22
22 23
443 23
23 24
444 24
2...

result:

ok 

Test #22:

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

input:

768 7
27 3 40 6 39 9 48 31

output:

767 18960055
384 1
385 1
1 2
386 2
2 3
387 3
3 4
388 4
4 5
389 5
5 6
390 6
6 7
391 7
7 8
392 8
8 9
393 9
9 10
394 10
10 11
395 11
11 12
396 12
12 13
397 13
13 14
398 14
14 15
399 15
15 16
400 16
16 17
401 17
17 18
402 18
18 19
403 19
19 20
404 20
20 21
405 21
21 22
406 22
22 23
407 23
23 24
408 24
2...

result:

ok 

Test #23:

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

input:

783 3
25 19 31 45

output:

782 4263811
88 1
89 1
90 1
91 1
92 1
93 1
94 1
95 1
96 1
1 2
97 2
98 2
99 2
100 2
101 2
102 2
103 2
104 2
2 3
105 3
106 3
107 3
108 3
109 3
110 3
111 3
112 3
3 4
113 4
114 4
115 4
116 4
117 4
118 4
119 4
120 4
4 5
121 5
122 5
123 5
124 5
125 5
126 5
127 5
128 5
5 6
129 6
130 6
131 6
132 6
133 6
134 ...

result:

ok 

Test #24:

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

input:

2 4
24 9 31 45 15

output:

1 248
1 2

result:

ok 

Test #25:

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

input:

792 5
28 40 21 32 44 11

output:

791 6695732
265 1
266 1
267 1
1 2
268 2
269 2
2 3
270 3
271 3
3 4
272 4
273 4
4 5
274 5
275 5
5 6
276 6
277 6
6 7
278 7
279 7
7 8
280 8
281 8
8 9
282 9
283 9
9 10
284 10
285 10
10 11
286 11
287 11
11 12
288 12
289 12
12 13
290 13
291 13
13 14
292 14
293 14
14 15
294 15
295 15
15 16
296 16
297 16
16 ...

result:

ok 

Test #26:

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

input:

939 5
35 7 31 40 25 28

output:

938 12031060
313 1
314 1
315 1
316 1
1 2
317 2
318 2
2 3
319 3
320 3
3 4
321 4
322 4
4 5
323 5
324 5
5 6
325 6
326 6
6 7
327 7
328 7
7 8
329 8
330 8
8 9
331 9
332 9
9 10
333 10
334 10
10 11
335 11
336 11
11 12
337 12
338 12
12 13
339 13
340 13
13 14
341 14
342 14
14 15
343 15
344 15
15 16
345 16
346...

result:

ok 

Test #27:

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

input:

924 6
30 26 21 8 12 42 26

output:

923 14203740
462 1
463 1
1 2
464 2
2 3
465 3
3 4
466 4
4 5
467 5
5 6
468 6
6 7
469 7
7 8
470 8
8 9
471 9
9 10
472 10
10 11
473 11
11 12
474 12
12 13
475 13
13 14
476 14
14 15
477 15
15 16
478 16
16 17
479 17
17 18
480 18
18 19
481 19
19 20
482 20
20 21
483 21
21 22
484 22
22 23
485 23
23 24
486 24
2...

result:

ok 

Test #28:

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

input:

902 8
8 48 35 25 32 28 21 2 44

output:

901 13244886
901 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 5...

result:

ok 

Test #29:

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

input:

1021 2
11 16 14

output:

1020 977447
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 1
65 1
66 1
67 1
68 1
69 1
70 1
71 1
72 1
73 1
74 1
75 ...

result:

ok 

Test #30:

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

input:

1 9
18 7 32 20 44 12 15 38 14 43

output:

0 18

result:

ok 

Test #31:

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

input:

1060 3
22 35 14 10

output:

1059 3631294
68 1
69 1
70 1
71 1
72 1
73 1
74 1
75 1
76 1
77 1
78 1
79 1
80 1
81 1
82 1
83 1
1 2
84 2
85 2
86 2
87 2
88 2
89 2
90 2
91 2
92 2
93 2
94 2
95 2
96 2
97 2
98 2
2 3
99 3
100 3
101 3
102 3
103 3
104 3
105 3
106 3
107 3
108 3
109 3
110 3
111 3
112 3
113 3
3 4
114 4
115 4
116 4
117 4
118 4
1...

result:

ok 

Test #32:

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

input:

1174 9
43 31 31 48 26 3 12 24 44 15

output:

1173 32850542
587 1
588 1
1 2
589 2
2 3
590 3
3 4
591 4
4 5
592 5
5 6
593 6
6 7
594 7
7 8
595 8
8 9
596 9
9 10
597 10
10 11
598 11
11 12
599 12
12 13
600 13
13 14
601 14
14 15
602 15
15 16
603 16
16 17
604 17
17 18
605 18
18 19
606 19
19 20
607 20
20 21
608 21
21 22
609 22
22 23
610 23
23 24
611 24
...

result:

ok 

Test #33:

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

input:

1132 7
22 41 20 40 1 45 15 41

output:

1131 30428525
566 1
567 1
1 2
568 2
2 3
569 3
3 4
570 4
4 5
571 5
5 6
572 6
6 7
573 7
7 8
574 8
8 9
575 9
9 10
576 10
10 11
577 11
11 12
578 12
12 13
579 13
13 14
580 14
14 15
581 15
15 16
582 16
16 17
583 17
17 18
584 18
18 19
585 19
19 20
586 20
20 21
587 21
21 22
588 22
22 23
589 23
23 24
590 24
...

result:

ok 

Test #34:

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

input:

1144 7
44 11 38 25 10 46 39 14

output:

1143 13475451
230 1
231 1
232 1
233 1
234 1
1 2
235 2
236 2
237 2
238 2
2 3
239 3
240 3
241 3
242 3
3 4
243 4
244 4
245 4
246 4
4 5
247 5
248 5
249 5
250 5
5 6
251 6
252 6
253 6
254 6
6 7
255 7
256 7
257 7
258 7
7 8
259 8
260 8
261 8
262 8
8 9
263 9
264 9
265 9
266 9
9 10
267 10
268 10
269 10
270 10...

result:

ok 

Test #35:

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

input:

143 1
20 39

output:

142 13936
2 1
3 1
4 1
5 1
6 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
21 1
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 ...

result:

ok 

Test #36:

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

input:

1193 8
13 14 30 29 27 45 20 50 12

output:

1192 23190532
597 1
598 1
1 2
599 2
2 3
600 3
3 4
601 4
4 5
602 5
5 6
603 6
6 7
604 7
7 8
605 8
8 9
606 9
9 10
607 10
10 11
608 11
11 12
609 12
12 13
610 13
13 14
611 14
14 15
612 15
15 16
613 16
16 17
614 17
17 18
615 18
18 19
616 19
19 20
617 20
20 21
618 21
21 22
619 22
22 23
620 23
23 24
621 24
...

result:

ok 

Test #37:

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

input:

1246 2
36 21 13

output:

1245 1190316
21 1
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 1
65 1
66 1
67 1
68 1
69 1
70 1
71 1
72 1
73 1
74 1
75 1
76 1
77 1
78...

result:

ok 

Test #38:

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

input:

1282 6
32 30 38 2 32 22 30

output:

1281 19528052
641 1
642 1
1 2
643 2
2 3
644 3
3 4
645 4
4 5
646 5
5 6
647 6
6 7
648 7
7 8
649 8
8 9
650 9
9 10
651 10
10 11
652 11
11 12
653 12
12 13
654 13
13 14
655 14
14 15
656 15
15 16
657 16
16 17
658 17
17 18
659 18
18 19
660 19
19 20
661 20
20 21
662 21
21 22
663 22
22 23
664 23
23 24
665 24
...

result:

ok 

Test #39:

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

input:

1219 5
1 18 2 24 13 41

output:

1218 19108189
407 1
408 1
409 1
1 2
410 2
411 2
2 3
412 3
413 3
3 4
414 4
415 4
4 5
416 5
417 5
5 6
418 6
419 6
6 7
420 7
421 7
7 8
422 8
423 8
8 9
424 9
425 9
9 10
426 10
427 10
10 11
428 11
429 11
11 12
430 12
431 12
12 13
432 13
433 13
13 14
434 14
435 14
14 15
436 15
437 15
15 16
438 16
439 16
1...

result:

ok 

Test #40:

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

input:

1275 7
1 2 2 10 48 11 39 18

output:

1274 12159175
214 1
215 1
216 1
217 1
218 1
219 1
1 2
220 2
221 2
222 2
223 2
224 2
2 3
225 3
226 3
227 3
228 3
229 3
3 4
230 4
231 4
232 4
233 4
234 4
4 5
235 5
236 5
237 5
238 5
239 5
5 6
240 6
241 6
242 6
243 6
244 6
6 7
245 7
246 7
247 7
248 7
249 7
7 8
250 8
251 8
252 8
253 8
254 8
8 9
255 9
25...

result:

ok 

Test #41:

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

input:

1204 6
42 39 31 45 1 45 15

output:

1203 20981458
402 1
403 1
404 1
1 2
405 2
406 2
2 3
407 3
408 3
3 4
409 4
410 4
4 5
411 5
412 5
5 6
413 6
414 6
6 7
415 7
416 7
7 8
417 8
418 8
8 9
419 9
420 9
9 10
421 10
422 10
10 11
423 11
424 11
11 12
425 12
426 12
12 13
427 13
428 13
13 14
429 14
430 14
14 15
431 15
432 15
15 16
433 16
434 16
1...

result:

ok 

Test #42:

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

input:

1433 6
36 45 32 28 2 47 35

output:

1432 27559374
717 1
718 1
1 2
719 2
2 3
720 3
3 4
721 4
4 5
722 5
5 6
723 6
6 7
724 7
7 8
725 8
8 9
726 9
9 10
727 10
10 11
728 11
11 12
729 12
12 13
730 13
13 14
731 14
14 15
732 15
15 16
733 16
16 17
734 17
17 18
735 18
18 19
736 19
19 20
737 20
20 21
738 21
21 22
739 22
22 23
740 23
23 24
741 24
...

result:

ok 

Test #43:

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

input:

1479 4
19 20 14 40 48

output:

1478 13245633
371 1
372 1
373 1
374 1
1 2
375 2
376 2
377 2
2 3
378 3
379 3
380 3
3 4
381 4
382 4
383 4
4 5
384 5
385 5
386 5
5 6
387 6
388 6
389 6
6 7
390 7
391 7
392 7
7 8
393 8
394 8
395 8
8 9
396 9
397 9
398 9
9 10
399 10
400 10
401 10
10 11
402 11
403 11
404 11
11 12
405 12
406 12
407 12
12 13
...

result:

ok 

Test #44:

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

input:

1416 5
13 30 1 3 23 37

output:

1415 20881768
473 1
474 1
475 1
1 2
476 2
477 2
2 3
478 3
479 3
3 4
480 4
481 4
4 5
482 5
483 5
5 6
484 6
485 6
6 7
486 7
487 7
7 8
488 8
489 8
8 9
490 9
491 9
9 10
492 10
493 10
10 11
494 11
495 11
11 12
496 12
497 12
12 13
498 13
499 13
13 14
500 14
501 14
14 15
502 15
503 15
15 16
504 16
505 16
1...

result:

ok 

Test #45:

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

input:

1366 2
23 7 45

output:

1365 2381528
40 1
41 1
42 1
43 1
44 1
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 1
65 1
66 1
67 1
68 1
69 1
70 1
71 1
72 1
73 1
74 1
1 2
75 2
76 2
77 2
78 2
79 2
80 2
81 2
82 2
83 2
84 2
85 2
86 2
87 2
88 2
89 2
90 2
91 2
92 2
93 2
94 2
95 2
96 ...

result:

ok 

Test #46:

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

input:

69 8
9 37 11 27 24 20 26 29 34

output:

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

result:

ok 

Test #47:

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

input:

1446 1
31 40

output:

1445 160426
2 1
3 1
4 1
5 1
6 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
21 1
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
6...

result:

ok 

Test #48:

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

input:

1558 7
1 20 1 18 19 32 23 31

output:

1557 27375776
779 1
780 1
1 2
781 2
2 3
782 3
3 4
783 4
4 5
784 5
5 6
785 6
6 7
786 7
7 8
787 8
8 9
788 9
9 10
789 10
10 11
790 11
11 12
791 12
12 13
792 13
13 14
793 14
14 15
794 15
15 16
795 16
16 17
796 17
17 18
797 18
18 19
798 19
19 20
799 20
20 21
800 21
21 22
801 22
22 23
802 23
23 24
803 24
...

result:

ok 

Test #49:

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

input:

1506 6
13 11 47 4 16 12 23

output:

1505 26313135
503 1
504 1
505 1
1 2
506 2
507 2
2 3
508 3
509 3
3 4
510 4
511 4
4 5
512 5
513 5
5 6
514 6
515 6
6 7
516 7
517 7
7 8
518 8
519 8
8 9
520 9
521 9
9 10
522 10
523 10
10 11
524 11
525 11
11 12
526 12
527 12
12 13
528 13
529 13
13 14
530 14
531 14
14 15
532 15
533 15
15 16
534 16
535 16
1...

result:

ok 

Test #50:

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

input:

1502 10
7 28 34 22 15 12 39 22 3 12 1

output:

1501 30324390
751 1
752 1
1 2
753 2
2 3
754 3
3 4
755 4
4 5
756 5
5 6
757 6
6 7
758 7
7 8
759 8
8 9
760 9
9 10
761 10
10 11
762 11
11 12
763 12
12 13
764 13
13 14
765 14
14 15
766 15
15 16
767 16
16 17
768 17
17 18
769 18
18 19
770 19
19 20
771 20
20 21
772 21
21 22
773 22
22 23
774 23
23 24
775 24
...

result:

ok 

Test #51:

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

input:

1554 6
40 26 7 34 32 25 10

output:

1553 17872648
312 1
313 1
314 1
315 1
316 1
1 2
317 2
318 2
319 2
320 2
2 3
321 3
322 3
323 3
324 3
3 4
325 4
326 4
327 4
328 4
4 5
329 5
330 5
331 5
332 5
5 6
333 6
334 6
335 6
336 6
6 7
337 7
338 7
339 7
340 7
7 8
341 8
342 8
343 8
344 8
8 9
345 9
346 9
347 9
348 9
9 10
349 10
350 10
351 10
352 10...

result:

ok 

Test #52:

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

input:

1641 6
4 4 50 32 36 21 45

output:

1640 34686354
821 1
822 1
1 2
823 2
2 3
824 3
3 4
825 4
4 5
826 5
5 6
827 6
6 7
828 7
7 8
829 8
8 9
830 9
9 10
831 10
10 11
832 11
11 12
833 12
12 13
834 13
13 14
835 14
14 15
836 15
15 16
837 16
16 17
838 17
17 18
839 18
18 19
840 19
19 20
841 20
20 21
842 21
21 22
843 22
22 23
844 23
23 24
845 24
...

result:

ok 

Test #53:

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

input:

1704 9
34 25 28 32 46 31 13 5 10 3

output:

1703 33186050
852 1
853 1
1 2
854 2
2 3
855 3
3 4
856 4
4 5
857 5
5 6
858 6
6 7
859 7
7 8
860 8
8 9
861 9
9 10
862 10
10 11
863 11
11 12
864 12
12 13
865 13
13 14
866 14
14 15
867 15
15 16
868 16
16 17
869 17
17 18
870 18
18 19
871 19
19 20
872 20
20 21
873 21
21 22
874 22
22 23
875 23
23 24
876 24
...

result:

ok 

Test #54:

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

input:

1729 10
1 45 47 48 14 11 16 5 44 43 39

output:

1728 28886428
1728 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...

result:

ok 

Test #55:

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

input:

1674 8
46 26 8 27 50 42 16 8 14

output:

1673 24479277
559 1
560 1
561 1
1 2
562 2
563 2
2 3
564 3
565 3
3 4
566 4
567 4
4 5
568 5
569 5
5 6
570 6
571 6
6 7
572 7
573 7
7 8
574 8
575 8
8 9
576 9
577 9
9 10
578 10
579 10
10 11
580 11
581 11
11 12
582 12
583 12
12 13
584 13
585 13
13 14
586 14
587 14
14 15
588 15
589 15
15 16
590 16
591 16
1...

result:

ok 

Test #56:

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

input:

1791 5
2 4 36 30 27 46

output:

1790 33867308
598 1
599 1
600 1
1 2
601 2
602 2
2 3
603 3
604 3
3 4
605 4
606 4
4 5
607 5
608 5
5 6
609 6
610 6
6 7
611 7
612 7
7 8
613 8
614 8
8 9
615 9
616 9
9 10
617 10
618 10
10 11
619 11
620 11
11 12
621 12
622 12
12 13
623 13
624 13
13 14
625 14
626 14
14 15
627 15
628 15
15 16
629 16
630 16
1...

result:

ok 

Test #57:

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

input:

219 6
11 26 45 49 10 1 14

output:

218 3123505
56 1
57 1
58 1
59 1
1 2
60 2
61 2
62 2
2 3
63 3
64 3
65 3
3 4
66 4
67 4
68 4
4 5
69 5
70 5
71 5
5 6
72 6
73 6
74 6
6 7
75 7
76 7
77 7
7 8
78 8
79 8
80 8
8 9
81 9
82 9
83 9
9 10
84 10
85 10
86 10
10 11
87 11
88 11
89 11
11 12
90 12
91 12
92 12
12 13
93 13
94 13
95 13
13 14
96 14
97 14
98 ...

result:

ok 

Test #58:

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

input:

1774 3
39 29 31 6

output:

1773 5370690
100 1
101 1
102 1
103 1
104 1
105 1
106 1
107 1
108 1
109 1
110 1
111 1
112 1
113 1
114 1
115 1
116 1
117 1
1 2
118 2
119 2
120 2
121 2
122 2
123 2
124 2
125 2
126 2
127 2
128 2
129 2
130 2
131 2
132 2
133 2
134 2
2 3
135 3
136 3
137 3
138 3
139 3
140 3
141 3
142 3
143 3
144 3
145 3
146...

result:

ok 

Test #59:

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

input:

1830 6
25 31 32 37 2 1 43

output:

1829 30462134
915 1
916 1
1 2
917 2
2 3
918 3
3 4
919 4
4 5
920 5
5 6
921 6
6 7
922 7
7 8
923 8
8 9
924 9
9 10
925 10
10 11
926 11
11 12
927 12
12 13
928 13
13 14
929 14
14 15
930 15
15 16
931 16
16 17
932 17
17 18
933 18
18 19
934 19
19 20
935 20
20 21
936 21
21 22
937 22
22 23
938 23
23 24
939 24
...

result:

ok 

Test #60:

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

input:

1886 5
36 33 10 5 16 31

output:

1885 23079262
629 1
630 1
631 1
1 2
632 2
633 2
2 3
634 3
635 3
3 4
636 4
637 4
4 5
638 5
639 5
5 6
640 6
641 6
6 7
642 7
643 7
7 8
644 8
645 8
8 9
646 9
647 9
9 10
648 10
649 10
10 11
650 11
651 11
11 12
652 12
653 12
12 13
654 13
655 13
13 14
656 14
657 14
14 15
658 15
659 15
15 16
660 16
661 16
1...

result:

ok 

Test #61:

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

input:

1907 7
9 37 49 23 34 14 29 24

output:

1906 20753757
954 1
955 1
1 2
956 2
2 3
957 3
3 4
958 4
4 5
959 5
5 6
960 6
6 7
961 7
7 8
962 8
8 9
963 9
9 10
964 10
10 11
965 11
11 12
966 12
12 13
967 13
13 14
968 14
14 15
969 15
15 16
970 16
16 17
971 17
17 18
972 18
18 19
973 19
19 20
974 20
20 21
975 21
21 22
976 22
22 23
977 23
23 24
978 24
...

result:

ok 

Test #62:

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

input:

1840 2
30 14 7

output:

1839 1289412
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 1
65 1
66 1
67 1
68 1
69 1
70 1
71 1
72 1
73 1
74 1
75 1
76 1
77 1
78 1
79...

result:

ok 

Test #63:

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

input:

1845 3
46 42 35 46

output:

1844 10496398
206 1
207 1
208 1
209 1
210 1
211 1
212 1
213 1
214 1
1 2
215 2
216 2
217 2
218 2
219 2
220 2
221 2
222 2
2 3
223 3
224 3
225 3
226 3
227 3
228 3
229 3
230 3
3 4
231 4
232 4
233 4
234 4
235 4
236 4
237 4
238 4
4 5
239 5
240 5
241 5
242 5
243 5
244 5
245 5
246 5
5 6
247 6
248 6
249 6
25...

result:

ok 

Test #64:

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

input:

2029 2
41 7 2

output:

2028 808537
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 1
65 1
66 1
67 1
68 1
69 1
70 ...

result:

ok 

Test #65:

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

input:

2084 7
40 34 44 27 31 24 50 14

output:

2083 37527190
695 1
696 1
697 1
1 2
698 2
699 2
2 3
700 3
701 3
3 4
702 4
703 4
4 5
704 5
705 5
5 6
706 6
707 6
6 7
708 7
709 7
7 8
710 8
711 8
8 9
712 9
713 9
9 10
714 10
715 10
10 11
716 11
717 11
11 12
718 12
719 12
12 13
720 13
721 13
13 14
722 14
723 14
14 15
724 15
725 15
15 16
726 16
727 16
1...

result:

ok 

Test #66:

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

input:

2002 9
9 8 5 42 1 3 24 27 42 41

output:

2001 74458404
2001 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...

result:

ok 

Test #67:

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

input:

2013 6
40 34 25 24 15 45 29

output:

2012 35161186
672 1
673 1
674 1
1 2
675 2
676 2
2 3
677 3
678 3
3 4
679 4
680 4
4 5
681 5
682 5
5 6
683 6
684 6
6 7
685 7
686 7
7 8
687 8
688 8
8 9
689 9
690 9
9 10
691 10
692 10
10 11
693 11
694 11
11 12
695 12
696 12
12 13
697 13
698 13
13 14
699 14
700 14
14 15
701 15
702 15
15 16
703 16
704 16
1...

result:

ok 

Test #68:

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

input:

199 5
17 8 15 42 48 4

output:

198 2382209
51 1
52 1
53 1
54 1
1 2
55 2
56 2
57 2
2 3
58 3
59 3
60 3
3 4
61 4
62 4
63 4
4 5
64 5
65 5
66 5
5 6
67 6
68 6
69 6
6 7
70 7
71 7
72 7
7 8
73 8
74 8
75 8
8 9
76 9
77 9
78 9
9 10
79 10
80 10
81 10
10 11
82 11
83 11
84 11
11 12
85 12
86 12
87 12
12 13
88 13
89 13
90 13
13 14
91 14
92 14
93 ...

result:

ok 

Test #69:

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

input:

1966 7
37 19 37 24 32 9 37 14

output:

1965 29203766
657 1
658 1
659 1
1 2
660 2
661 2
2 3
662 3
663 3
3 4
664 4
665 4
4 5
666 5
667 5
5 6
668 6
669 6
6 7
670 7
671 7
7 8
672 8
673 8
8 9
674 9
675 9
9 10
676 10
677 10
10 11
678 11
679 11
11 12
680 12
681 12
12 13
682 13
683 13
13 14
684 14
685 14
14 15
686 15
687 15
15 16
688 16
689 16
1...

result:

ok 

Test #70:

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

input:

2211 5
49 7 4 27 10 6

output:

2210 15935989
554 1
555 1
556 1
557 1
1 2
558 2
559 2
560 2
2 3
561 3
562 3
563 3
3 4
564 4
565 4
566 4
4 5
567 5
568 5
569 5
5 6
570 6
571 6
572 6
6 7
573 7
574 7
575 7
7 8
576 8
577 8
578 8
8 9
579 9
580 9
581 9
9 10
582 10
583 10
584 10
10 11
585 11
586 11
587 11
11 12
588 12
589 12
590 12
12 13
...

result:

ok 

Test #71:

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

input:

2187 7
33 36 31 49 29 15 43 18

output:

2186 21094741
1094 1
1095 1
1 2
1096 2
2 3
1097 3
3 4
1098 4
4 5
1099 5
5 6
1100 6
6 7
1101 7
7 8
1102 8
8 9
1103 9
9 10
1104 10
10 11
1105 11
11 12
1106 12
12 13
1107 13
13 14
1108 14
14 15
1109 15
15 16
1110 16
16 17
1111 17
17 18
1112 18
18 19
1113 19
19 20
1114 20
20 21
1115 21
21 22
1116 22
22 ...

result:

ok 

Test #72:

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

input:

2155 6
20 28 43 19 45 19 40

output:

2154 41581356
1078 1
1079 1
1 2
1080 2
2 3
1081 3
3 4
1082 4
4 5
1083 5
5 6
1084 6
6 7
1085 7
7 8
1086 8
8 9
1087 9
9 10
1088 10
10 11
1089 11
11 12
1090 12
12 13
1091 13
13 14
1092 14
14 15
1093 15
15 16
1094 16
16 17
1095 17
17 18
1096 18
18 19
1097 19
19 20
1098 20
20 21
1099 21
21 22
1100 22
22 ...

result:

ok 

Test #73:

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

input:

2116 8
15 11 9 46 41 24 2 17 37

output:

2115 57657640
1058 1
1059 1
1 2
1060 2
2 3
1061 3
3 4
1062 4
4 5
1063 5
5 6
1064 6
6 7
1065 7
7 8
1066 8
8 9
1067 9
9 10
1068 10
10 11
1069 11
11 12
1070 12
12 13
1071 13
13 14
1072 14
14 15
1073 15
15 16
1074 16
16 17
1075 17
17 18
1076 18
18 19
1077 19
19 20
1078 20
20 21
1079 21
21 22
1080 22
22 ...

result:

ok 

Test #74:

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

input:

2235 4
46 43 36 45 46

output:

2234 20192476
560 1
561 1
562 1
563 1
1 2
564 2
565 2
566 2
2 3
567 3
568 3
569 3
3 4
570 4
571 4
572 4
4 5
573 5
574 5
575 5
5 6
576 6
577 6
578 6
6 7
579 7
580 7
581 7
7 8
582 8
583 8
584 8
8 9
585 9
586 9
587 9
9 10
588 10
589 10
590 10
10 11
591 11
592 11
593 11
11 12
594 12
595 12
596 12
12 13
...

result:

ok 

Test #75:

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

input:

2386 6
33 46 3 3 36 47 3

output:

2385 23421354
597 1
598 1
599 1
600 1
1 2
601 2
602 2
603 2
2 3
604 3
605 3
606 3
3 4
607 4
608 4
609 4
4 5
610 5
611 5
612 5
5 6
613 6
614 6
615 6
6 7
616 7
617 7
618 7
7 8
619 8
620 8
621 8
8 9
622 9
623 9
624 9
9 10
625 10
626 10
627 10
10 11
628 11
629 11
630 11
11 12
631 12
632 12
633 12
12 13
...

result:

ok 

Test #76:

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

input:

2256 5
44 29 21 9 14 34

output:

2255 32619088
565 1
566 1
567 1
568 1
1 2
569 2
570 2
571 2
2 3
572 3
573 3
574 3
3 4
575 4
576 4
577 4
4 5
578 5
579 5
580 5
5 6
581 6
582 6
583 6
6 7
584 7
585 7
586 7
7 8
587 8
588 8
589 8
8 9
590 9
591 9
592 9
9 10
593 10
594 10
595 10
10 11
596 11
597 11
598 11
11 12
599 12
600 12
601 12
12 13
...

result:

ok 

Test #77:

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

input:

2262 9
21 4 35 10 47 35 37 25 48 34

output:

2261 84490692
2261 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...

result:

ok 

Test #78:

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

input:

2257 7
26 17 20 30 32 11 41 13

output:

2256 35113744
752 1
753 1
754 1
755 1
1 2
756 2
757 2
758 2
2 3
759 3
760 3
3 4
761 4
762 4
4 5
763 5
764 5
5 6
765 6
766 6
6 7
767 7
768 7
7 8
769 8
770 8
8 9
771 9
772 9
9 10
773 10
774 10
10 11
775 11
776 11
11 12
777 12
778 12
12 13
779 13
780 13
13 14
781 14
782 14
14 15
783 15
784 15
15 16
785...

result:

ok 

Test #79:

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

input:

226 8
34 21 19 16 21 28 2 37 39

output:

225 5680290
113 1
114 1
1 2
115 2
2 3
116 3
3 4
117 4
4 5
118 5
5 6
119 6
6 7
120 7
7 8
121 8
8 9
122 9
9 10
123 10
10 11
124 11
11 12
125 12
12 13
126 13
13 14
127 14
14 15
128 15
15 16
129 16
16 17
130 17
17 18
131 18
18 19
132 19
19 20
133 20
20 21
134 21
21 22
135 22
22 23
136 23
23 24
137 24
24...

result:

ok 

Test #80:

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

input:

2331 5
36 50 29 20 5 29

output:

2330 25841563
777 1
778 1
779 1
780 1
1 2
781 2
782 2
2 3
783 3
784 3
3 4
785 4
786 4
4 5
787 5
788 5
5 6
789 6
790 6
6 7
791 7
792 7
7 8
793 8
794 8
8 9
795 9
796 9
9 10
797 10
798 10
10 11
799 11
800 11
11 12
801 12
802 12
12 13
803 13
804 13
13 14
805 14
806 14
14 15
807 15
808 15
15 16
809 16
81...

result:

ok 

Test #81:

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

input:

2454 6
34 22 1 23 44 1 27

output:

2453 29880376
1227 1
1228 1
1 2
1229 2
2 3
1230 3
3 4
1231 4
4 5
1232 5
5 6
1233 6
6 7
1234 7
7 8
1235 8
8 9
1236 9
9 10
1237 10
10 11
1238 11
11 12
1239 12
12 13
1240 13
13 14
1241 14
14 15
1242 15
15 16
1243 16
16 17
1244 17
17 18
1245 18
18 19
1246 19
19 20
1247 20
20 21
1248 21
21 22
1249 22
22 ...

result:

ok 

Test #82:

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

input:

2493 1
6 37

output:

2492 199366
3 1
4 1
5 1
6 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
21 1
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
...

result:

ok 

Test #83:

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

input:

2449 9
15 44 43 25 41 9 49 37 50 25

output:

2448 85378953
2448 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...

result:

ok 

Test #84:

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

input:

2424 4
26 19 47 14 30

output:

2423 21435242
486 1
487 1
488 1
489 1
490 1
1 2
491 2
492 2
493 2
494 2
2 3
495 3
496 3
497 3
498 3
3 4
499 4
500 4
501 4
502 4
4 5
503 5
504 5
505 5
506 5
5 6
507 6
508 6
509 6
510 6
6 7
511 7
512 7
513 7
514 7
7 8
515 8
516 8
517 8
518 8
8 9
519 9
520 9
521 9
522 9
9 10
523 10
524 10
525 10
526 10...

result:

ok 

Test #85:

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

input:

2510 9
50 17 37 5 25 10 5 27 18 35

output:

2509 68458826
2509 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...

result:

ok 

Test #86:

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

input:

2600 4
16 19 18 19 49

output:

2599 22021756
651 1
652 1
653 1
654 1
1 2
655 2
656 2
657 2
2 3
658 3
659 3
660 3
3 4
661 4
662 4
663 4
4 5
664 5
665 5
666 5
5 6
667 6
668 6
669 6
6 7
670 7
671 7
672 7
7 8
673 8
674 8
675 8
8 9
676 9
677 9
678 9
9 10
679 10
680 10
681 10
10 11
682 11
683 11
684 11
11 12
685 12
686 12
687 12
12 13
...

result:

ok 

Test #87:

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

input:

2695 7
25 39 43 5 29 2 49 24

output:

2694 43794209
1348 1
1349 1
1 2
1350 2
2 3
1351 3
3 4
1352 4
4 5
1353 5
5 6
1354 6
6 7
1355 7
7 8
1356 8
8 9
1357 9
9 10
1358 10
10 11
1359 11
11 12
1360 12
12 13
1361 13
13 14
1362 14
14 15
1363 15
15 16
1364 16
16 17
1365 17
17 18
1366 18
18 19
1367 19
19 20
1368 20
20 21
1369 21
21 22
1370 22
22 ...

result:

ok 

Test #88:

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

input:

2661 10
49 45 22 28 7 50 45 33 33 18 13

output:

2660 107006823
2660 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
5...

result:

ok 

Test #89:

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

input:

2626 7
40 5 15 8 28 13 22 12

output:

2625 63314782
1313 1
1314 1
1 2
1315 2
2 3
1316 3
3 4
1317 4
4 5
1318 5
5 6
1319 6
6 7
1320 7
7 8
1321 8
8 9
1322 9
9 10
1323 10
10 11
1324 11
11 12
1325 12
12 13
1326 13
13 14
1327 14
14 15
1328 15
15 16
1329 16
16 17
1330 17
17 18
1331 18
18 19
1332 19
19 20
1333 20
20 21
1334 21
21 22
1335 22
22 ...

result:

ok 

Test #90:

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

input:

255 4
11 1 4 13 42

output:

254 2896197
52 1
53 1
54 1
55 1
56 1
1 2
57 2
58 2
59 2
60 2
2 3
61 3
62 3
63 3
64 3
3 4
65 4
66 4
67 4
68 4
4 5
69 5
70 5
71 5
72 5
5 6
73 6
74 6
75 6
76 6
6 7
77 7
78 7
79 7
80 7
7 8
81 8
82 8
83 8
84 8
8 9
85 9
86 9
87 9
88 9
9 10
89 10
90 10
91 10
92 10
10 11
93 11
94 11
95 11
96 11
11 12
97 12
...

result:

ok 

Test #91:

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

input:

2563 7
40 13 13 37 28 21 8 24

output:

2562 35788764
854 1
855 1
856 1
857 1
858 1
1 2
859 2
860 2
2 3
861 3
862 3
3 4
863 4
864 4
4 5
865 5
866 5
5 6
867 6
868 6
6 7
869 7
870 7
7 8
871 8
872 8
8 9
873 9
874 9
9 10
875 10
876 10
10 11
877 11
878 11
11 12
879 12
880 12
12 13
881 13
882 13
13 14
883 14
884 14
14 15
885 15
886 15
15 16
887...

result:

ok 

Test #92:

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

input:

2768 8
25 18 26 34 13 30 47 6 47

output:

2767 48164850
2767 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...

result:

ok 

Test #93:

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

input:

2757 8
31 36 12 14 35 43 44 19 21

output:

2756 65276248
1379 1
1380 1
1 2
1381 2
2 3
1382 3
3 4
1383 4
4 5
1384 5
5 6
1385 6
6 7
1386 7
7 8
1387 8
8 9
1388 9
9 10
1389 10
10 11
1390 11
11 12
1391 12
12 13
1392 13
13 14
1393 14
14 15
1394 15
15 16
1395 16
16 17
1396 17
17 18
1397 18
18 19
1398 19
19 20
1399 20
20 21
1400 21
21 22
1401 22
22 ...

result:

ok 

Test #94:

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

input:

2739 9
43 26 15 47 1 50 41 45 23 49

output:

2738 113605339
2738 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
5...

result:

ok 

Test #95:

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

input:

2719 9
6 17 3 39 27 7 37 36 35 1

output:

2718 47460972
2718 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...

result:

ok 

Test #96:

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

input:

2793 9
2 50 17 43 35 38 32 6 47 50

output:

2792 119282398
2792 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
5...

result:

ok 

Test #97:

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

input:

2879 8
12 7 41 14 5 9 34 25 16

output:

2878 29178860
2878 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...

result:

ok 

Test #98:

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

input:

2997 1
6 29

output:

2996 191750
3 1
4 1
5 1
6 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
21 1
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
...

result:

ok 

Test #99:

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

input:

2993 8
2 50 21 40 45 19 9 36 30

output:

2992 81471772
1497 1
1498 1
1 2
1499 2
2 3
1500 3
3 4
1501 4
4 5
1502 5
5 6
1503 6
6 7
1504 7
7 8
1505 8
8 9
1506 9
9 10
1507 10
10 11
1508 11
11 12
1509 12
12 13
1510 13
13 14
1511 14
14 15
1512 15
15 16
1513 16
16 17
1514 17
17 18
1515 18
18 19
1516 19
19 20
1517 20
20 21
1518 21
21 22
1519 22
22 ...

result:

ok 

Test #100:

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

input:

2993 1
9 45

output:

2992 296217
4 1
5 1
6 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
21 1
22 1
23 1
24 1
25 1
26 1
27 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
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1...

result:

ok