QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#21593#2848. 城市地铁规划Mr_Eight#AC ✓108ms66360kbC++142.8kb2022-03-07 15:53:422022-05-08 03:40:56

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-08 03:40:56]
  • 评测
  • 测评结果:AC
  • 用时:108ms
  • 内存:66360kb
  • [2022-03-07 15:53:42]
  • 提交

answer

//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <random>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define itn int
#define nit int
#define ll long long
#define ms multiset
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define re register
#define ri re int
#define il inline
#define pii pair<int,int>
#define cp complex<double>
//#pra gma G CC opti mize(3)
using namespace std;
using std::bitset;
//using namespace __gnu_pbds;
const double Pi=acos(-1);
namespace fastIO {
	template<class T>
	inline void read(T &x) {
		x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		if(fu)x=-x;
	}
	inline int read() {
		int x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		return fu?-x:x;
	}
	template<class T,class... Args>
	inline void read(T& t,Args&... args) {
		read(t);
		read(args...);
	}
	char _n_u_m_[40];
	template<class T>
	inline void write(T x ) {
		if(x==0){
			putchar('0');
			return;
		}
		T tmp = x > 0 ? x : -x ;
		if( x < 0 ) putchar('-') ;
		register int cnt = 0 ;
		while( tmp > 0 ) {
			_n_u_m_[ cnt ++ ] = tmp % 10 + '0' ;
			tmp /= 10 ;
		}
		while( cnt > 0 ) putchar(_n_u_m_[ -- cnt ]) ;
	}
	template<class T>
	inline void write(T x ,char ch) {
		write(x);
		putchar(ch);
	}
}
using namespace fastIO;
int f[3002][3002],v[3002],g[3002][3002];
int n,k,a[3002];
inline bool ck(int &x,int y){
	if(x<y){
		x=y;
		return true;
	}
	return false;
}
inline void solve(int l,int r,int num,int to){
	if(num==1&&to){
		write(r,' ');
		write(to,'\n');
	}
	if(l==r)return;
	int pos=g[r-l+1][num];
	if(num==1)solve(l,r-1,pos,r);
	else{
		solve(r-pos+1,r,1,to);
		solve(l,r-pos,num-1,to);
	}
}
int main(){
	cin>>n>>k;
	F(i,0,k){
		read(a[i]);
	}
	F(i,0,n){
		UF(j,k,0){
			v[i]=(1ll*v[i]*i+a[j])%59393;
		}
	}
	if(n==1){
		cout<<0<<" "<<v[0]<<endl;
		return 0;
	}
	memset(f,-0x3f,sizeof(f));
	f[1][1]=v[1];
	F(i,1,n){
		F(j,1,i)if(ck(f[i][1],f[i-1][j]+v[j+(i!=n)]))g[i][1]=j;
		F(j,2,i){
			F(k,1,i/j){
				if(ck(f[i][j],f[k][1]+f[i-k][j-1]))g[i][j]=k;
			}
		}
	}
	write(n-1,' ');
	write(f[n][1],'\n');
	solve(1,n,1,0);
    return 0;
}


詳細信息

Test #1:

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

input:

63 7
4 50 14 48 33 13 44 24

output:

62 992106
62 63
61 62
60 61
59 61
58 59
57 59
56 57
55 57
54 55
53 55
52 53
51 53
50 51
49 51
48 49
47 49
46 47
45 47
44 45
43 45
42 43
41 43
40 41
39 41
38 39
37 39
36 37
35 37
34 35
33 35
32 33
31 33
30 31
29 31
28 29
27 29
26 27
25 27
24 25
23 25
22 23
21 23
20 21
19 21
18 19
17 19
16 17
15 17
14...

result:

ok 

Test #2:

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

input:

208 7
23 28 14 16 46 28 26 28

output:

207 3317121
207 208
206 207
205 207
204 205
203 205
202 203
201 203
200 201
199 201
198 199
197 199
196 197
195 197
194 195
193 195
192 193
191 193
190 191
189 191
188 189
187 189
186 187
185 187
184 185
183 185
182 183
181 183
180 181
179 181
178 179
177 179
176 177
175 177
174 175
173 175
172 173
...

result:

ok 

Test #3:

score: 0
Accepted
time: 97ms
memory: 65912kb

input:

2928 3
27 20 7 29

output:

2927 13889888
2927 2928
2926 2927
2925 2927
2924 2927
2923 2927
2922 2927
2921 2927
2920 2927
2919 2927
2918 2927
2917 2927
2916 2927
2915 2916
2914 2916
2913 2916
2912 2916
2911 2916
2910 2916
2909 2916
2908 2916
2907 2916
2906 2916
2905 2916
2904 2905
2903 2905
2902 2905
2901 2905
2900 2905
2899 2...

result:

ok 

Test #4:

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

input:

320 3
46 42 15 15

output:

319 1260206
319 320
318 319
317 319
316 319
315 319
314 319
313 319
312 319
311 319
310 319
309 319
308 309
307 309
306 309
305 309
304 309
303 309
302 309
301 309
300 309
299 309
298 309
297 309
296 309
295 309
294 295
293 295
292 295
291 295
290 295
289 295
288 295
287 295
286 295
285 295
284 295
...

result:

ok 

Test #5:

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

input:

380 5
41 27 8 3 31 0

output:

379 3140470
379 380
378 379
377 379
376 379
375 376
374 376
373 376
372 376
371 376
370 371
369 371
368 371
367 371
366 371
365 366
364 366
363 366
362 366
361 366
360 361
359 361
358 361
357 361
356 361
355 356
354 356
353 356
352 356
351 356
350 351
349 351
348 351
347 351
346 351
345 346
344 346
...

result:

ok 

Test #6:

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

input:

365 5
35 20 24 29 3 25

output:

364 3508667
364 365
363 364
362 364
361 364
360 361
359 361
358 361
357 358
356 358
355 358
354 355
353 355
352 355
351 352
350 352
349 352
348 349
347 349
346 349
345 346
344 346
343 346
342 343
341 343
340 343
339 340
338 340
337 340
336 337
335 337
334 337
333 334
332 334
331 334
330 331
329 331
...

result:

ok 

Test #7:

score: 0
Accepted
time: 13ms
memory: 40576kb

input:

318 6
4 44 46 6 37 14 49

output:

317 6799456
317 318
316 317
315 317
314 315
313 315
312 313
311 313
310 311
309 311
308 309
307 309
306 307
305 307
304 305
303 305
302 303
301 303
300 301
299 301
298 299
297 299
296 297
295 297
294 295
293 295
292 293
291 293
290 291
289 291
288 289
287 289
286 287
285 287
284 285
283 285
282 283
...

result:

ok 

Test #8:

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

input:

416 6
30 23 4 16 45 32 19

output:

415 5383994
415 416
414 415
413 415
412 413
411 413
410 411
409 411
408 409
407 409
406 407
405 407
404 405
403 405
402 403
401 403
400 401
399 401
398 399
397 399
396 397
395 397
394 395
393 395
392 393
391 393
390 391
389 391
388 389
387 389
386 387
385 387
384 385
383 385
382 383
381 383
380 381
...

result:

ok 

Test #9:

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

input:

572 5
15 27 5 18 3 46

output:

571 9396678
571 572
570 571
569 571
568 571
567 568
566 568
565 568
564 565
563 565
562 565
561 562
560 562
559 562
558 559
557 559
556 559
555 556
554 556
553 556
552 553
551 553
550 553
549 550
548 550
547 550
546 547
545 547
544 547
543 544
542 544
541 544
540 541
539 541
538 541
537 538
536 538
...

result:

ok 

Test #10:

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

input:

531 8
20 13 35 27 41 43 36 25 5

output:

530 9024252
530 531
529 530
528 529
527 529
526 529
525 526
524 526
523 526
522 523
521 523
520 523
519 520
518 520
517 520
516 517
515 517
514 517
513 514
512 514
511 514
510 511
509 511
508 511
507 508
506 508
505 508
504 505
503 505
502 505
501 502
500 502
499 502
498 499
497 499
496 499
495 496
...

result:

ok 

Test #11:

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

input:

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

output:

486 18026623
486 487
485 486
484 485
483 484
482 483
481 482
480 481
479 480
478 479
477 478
476 477
475 476
474 475
473 474
472 473
471 472
470 471
469 470
468 469
467 468
466 467
465 466
464 465
463 464
462 463
461 462
460 461
459 460
458 459
457 458
456 457
455 456
454 455
453 454
452 453
451 452...

result:

ok 

Test #12:

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

input:

584 7
10 27 29 8 32 43 26 3

output:

583 11437238
583 584
582 583
581 583
580 581
579 581
578 579
577 579
576 577
575 577
574 575
573 575
572 573
571 573
570 571
569 571
568 569
567 569
566 567
565 567
564 565
563 565
562 563
561 563
560 561
559 561
558 559
557 559
556 557
555 557
554 555
553 555
552 553
551 553
550 551
549 551
548 549...

result:

ok 

Test #13:

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

input:

59 4
48 16 9 42 21

output:

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

result:

ok 

Test #14:

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

input:

561 3
22 31 17 49

output:

560 3223790
560 561
559 560
558 559
557 559
556 559
555 559
554 559
553 559
552 559
551 559
550 559
549 550
548 550
547 550
546 550
545 550
544 550
543 550
542 550
541 550
540 541
539 541
538 541
537 541
536 541
535 541
534 541
533 541
532 541
531 532
530 532
529 532
528 532
527 532
526 532
525 532
...

result:

ok 

Test #15:

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

input:

629 6
26 31 41 32 13 39 41

output:

628 13149156
628 629
627 628
626 627
625 627
624 625
623 625
622 623
621 623
620 621
619 621
618 619
617 619
616 617
615 617
614 615
613 615
612 613
611 613
610 611
609 611
608 609
607 609
606 607
605 607
604 605
603 605
602 603
601 603
600 601
599 601
598 599
597 599
596 597
595 597
594 595
593 595...

result:

ok 

Test #16:

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

input:

616 3
38 48 27 2

output:

615 1394108
615 616
614 615
613 615
612 615
611 615
610 615
609 615
608 615
607 615
606 615
605 615
604 615
603 615
602 615
601 615
600 601
599 601
598 601
597 601
596 601
595 601
594 601
593 601
592 601
591 601
590 601
589 601
588 601
587 601
586 601
585 601
584 601
583 601
582 601
581 601
580 601
...

result:

ok 

Test #17:

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

input:

744 2
49 45 50

output:

743 1425426
743 744
742 743
741 743
740 743
739 743
738 743
737 743
736 743
735 743
734 743
733 743
732 743
731 743
730 743
729 743
728 743
727 743
726 727
725 727
724 727
723 727
722 727
721 727
720 727
719 727
718 727
717 727
716 727
715 727
714 727
713 727
712 727
711 727
710 727
709 727
708 727
...

result:

ok 

Test #18:

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

input:

629 7
27 18 48 24 37 38 6 3

output:

628 9258317
628 629
627 628
626 627
625 627
624 625
623 625
622 625
621 625
620 621
619 621
618 621
617 621
616 617
615 617
614 617
613 617
612 613
611 613
610 613
609 613
608 609
607 609
606 609
605 609
604 605
603 605
602 605
601 605
600 601
599 601
598 601
597 601
596 597
595 597
594 597
593 597
...

result:

ok 

Test #19:

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

input:

602 8
17 25 14 13 2 16 23 24 44

output:

601 9947756
601 602
600 601
599 600
598 599
597 598
596 597
595 596
594 595
593 594
592 593
591 592
590 591
589 590
588 589
587 588
586 587
585 586
584 585
583 584
582 583
581 582
580 581
579 580
578 579
577 578
576 577
575 576
574 575
573 574
572 573
571 572
570 571
569 570
568 569
567 568
566 567
...

result:

ok 

Test #20:

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

input:

900 2
9 13 12

output:

899 787522
899 900
898 899
897 899
896 899
895 899
894 899
893 899
892 899
891 899
890 899
889 899
888 899
887 899
886 899
885 899
884 885
883 885
882 885
881 885
880 885
879 885
878 885
877 885
876 885
875 885
874 885
873 885
872 885
871 885
870 885
869 885
868 885
867 885
866 885
865 885
864 885
8...

result:

ok 

Test #21:

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

input:

839 7
12 12 28 33 35 29 14 17

output:

838 24516016
838 839
837 838
836 837
835 837
834 835
833 835
832 833
831 833
830 831
829 831
828 829
827 829
826 827
825 827
824 825
823 825
822 823
821 823
820 821
819 821
818 819
817 819
816 817
815 817
814 815
813 815
812 813
811 813
810 811
809 811
808 809
807 809
806 807
805 807
804 805
803 805...

result:

ok 

Test #22:

score: 0
Accepted
time: 17ms
memory: 44896kb

input:

768 7
27 3 40 6 39 9 48 31

output:

767 18960055
767 768
766 767
765 767
764 765
763 765
762 763
761 763
760 761
759 761
758 759
757 759
756 757
755 757
754 755
753 755
752 753
751 753
750 751
749 751
748 749
747 749
746 747
745 747
744 745
743 745
742 743
741 743
740 741
739 741
738 739
737 739
736 737
735 737
734 735
733 735
732 733...

result:

ok 

Test #23:

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

input:

783 3
25 19 31 45

output:

782 4263811
782 783
781 782
780 782
779 782
778 782
777 782
776 782
775 782
774 775
773 775
772 775
771 775
770 775
769 775
768 775
767 775
766 775
765 766
764 766
763 766
762 766
761 766
760 766
759 766
758 766
757 766
756 757
755 757
754 757
753 757
752 757
751 757
750 757
749 757
748 757
747 748
...

result:

ok 

Test #24:

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

input:

2 4
24 9 31 45 15

output:

1 248
1 2

result:

ok 

Test #25:

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

input:

792 5
28 40 21 32 44 11

output:

791 6695732
791 792
790 791
789 790
788 790
787 790
786 787
785 787
784 787
783 784
782 784
781 784
780 781
779 781
778 781
777 778
776 778
775 778
774 775
773 775
772 775
771 772
770 772
769 772
768 769
767 769
766 769
765 766
764 766
763 766
762 763
761 763
760 763
759 760
758 760
757 760
756 757
...

result:

ok 

Test #26:

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

input:

939 5
35 7 31 40 25 28

output:

938 12031060
938 939
937 938
936 938
935 938
934 935
933 935
932 935
931 932
930 932
929 932
928 929
927 929
926 929
925 926
924 926
923 926
922 923
921 923
920 923
919 920
918 920
917 920
916 917
915 917
914 917
913 914
912 914
911 914
910 911
909 911
908 911
907 908
906 908
905 908
904 905
903 905...

result:

ok 

Test #27:

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

input:

924 6
30 26 21 8 12 42 26

output:

923 14203740
923 924
922 923
921 923
920 921
919 921
918 919
917 919
916 917
915 917
914 915
913 915
912 913
911 913
910 911
909 911
908 909
907 909
906 907
905 907
904 905
903 905
902 903
901 903
900 901
899 901
898 899
897 899
896 897
895 897
894 895
893 895
892 893
891 893
890 891
889 891
888 889...

result:

ok 

Test #28:

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

input:

902 8
8 48 35 25 32 28 21 2 44

output:

901 13244886
901 902
900 901
899 900
898 899
897 898
896 897
895 896
894 895
893 894
892 893
891 892
890 891
889 890
888 889
887 888
886 887
885 886
884 885
883 884
882 883
881 882
880 881
879 880
878 879
877 878
876 877
875 876
874 875
873 874
872 873
871 872
870 871
869 870
868 869
867 868
866 867...

result:

ok 

Test #29:

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

input:

1021 2
11 16 14

output:

1020 977447
1020 1021
1019 1020
1018 1020
1017 1020
1016 1020
1015 1020
1014 1020
1013 1020
1012 1020
1011 1020
1010 1020
1009 1020
1008 1009
1007 1009
1006 1009
1005 1009
1004 1009
1003 1009
1002 1009
1001 1009
1000 1009
999 1009
998 1009
997 1009
996 1009
995 1009
994 1009
993 1009
992 1009
991 10...

result:

ok 

Test #30:

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

input:

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

output:

0 18

result:

ok 

Test #31:

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

input:

1060 3
22 35 14 10

output:

1059 3631294
1059 1060
1058 1059
1057 1059
1056 1057
1055 1057
1054 1057
1053 1057
1052 1057
1051 1057
1050 1057
1049 1057
1048 1057
1047 1057
1046 1057
1045 1057
1044 1057
1043 1057
1042 1057
1041 1057
1040 1041
1039 1041
1038 1041
1037 1041
1036 1041
1035 1041
1034 1041
1033 1041
1032 1041
1031 10...

result:

ok 

Test #32:

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

input:

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

output:

1173 32850542
1173 1174
1172 1173
1171 1173
1170 1171
1169 1171
1168 1169
1167 1169
1166 1167
1165 1167
1164 1165
1163 1165
1162 1163
1161 1163
1160 1161
1159 1161
1158 1159
1157 1159
1156 1157
1155 1157
1154 1155
1153 1155
1152 1153
1151 1153
1150 1151
1149 1151
1148 1149
1147 1149
1146 1147
1145 1...

result:

ok 

Test #33:

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

input:

1132 7
22 41 20 40 1 45 15 41

output:

1131 30428525
1131 1132
1130 1131
1129 1131
1128 1129
1127 1129
1126 1127
1125 1127
1124 1125
1123 1125
1122 1123
1121 1123
1120 1121
1119 1121
1118 1119
1117 1119
1116 1117
1115 1117
1114 1115
1113 1115
1112 1113
1111 1113
1110 1111
1109 1111
1108 1109
1107 1109
1106 1107
1105 1107
1104 1105
1103 1...

result:

ok 

Test #34:

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

input:

1144 7
44 11 38 25 10 46 39 14

output:

1143 13475451
1143 1144
1142 1143
1141 1143
1140 1141
1139 1141
1138 1141
1137 1141
1136 1141
1135 1136
1134 1136
1133 1136
1132 1136
1131 1136
1130 1131
1129 1131
1128 1131
1127 1131
1126 1131
1125 1126
1124 1126
1123 1126
1122 1126
1121 1126
1120 1121
1119 1121
1118 1121
1117 1121
1116 1121
1115 1...

result:

ok 

Test #35:

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

input:

143 1
20 39

output:

142 13936
142 143
141 142
140 141
139 140
138 139
137 138
136 137
135 136
134 135
133 134
132 133
131 132
130 131
129 130
128 129
127 128
126 127
125 126
124 125
123 124
122 123
121 122
120 121
119 120
118 119
117 118
116 117
115 116
114 115
113 114
112 113
111 112
110 111
109 110
108 109
107 108
10...

result:

ok 

Test #36:

score: 0
Accepted
time: 13ms
memory: 47924kb

input:

1193 8
13 14 30 29 27 45 20 50 12

output:

1192 23190532
1192 1193
1191 1192
1190 1191
1189 1191
1188 1189
1187 1189
1186 1187
1185 1187
1184 1185
1183 1185
1182 1183
1181 1183
1180 1181
1179 1181
1178 1179
1177 1179
1176 1177
1175 1177
1174 1175
1173 1175
1172 1173
1171 1173
1170 1171
1169 1171
1168 1169
1167 1169
1166 1167
1165 1167
1164 1...

result:

ok 

Test #37:

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

input:

1246 2
36 21 13

output:

1245 1190316
1245 1246
1244 1245
1243 1245
1242 1245
1241 1245
1240 1245
1239 1245
1238 1245
1237 1245
1236 1245
1235 1236
1234 1236
1233 1236
1232 1236
1231 1236
1230 1236
1229 1236
1228 1236
1227 1236
1226 1236
1225 1236
1224 1236
1223 1236
1222 1236
1221 1236
1220 1236
1219 1236
1218 1236
1217 12...

result:

ok 

Test #38:

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

input:

1282 6
32 30 38 2 32 22 30

output:

1281 19528052
1281 1282
1280 1281
1279 1281
1278 1279
1277 1279
1276 1277
1275 1277
1274 1275
1273 1275
1272 1273
1271 1273
1270 1271
1269 1271
1268 1269
1267 1269
1266 1267
1265 1267
1264 1265
1263 1265
1262 1263
1261 1263
1260 1261
1259 1261
1258 1259
1257 1259
1256 1257
1255 1257
1254 1255
1253 1...

result:

ok 

Test #39:

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

input:

1219 5
1 18 2 24 13 41

output:

1218 19108189
1218 1219
1217 1218
1216 1218
1215 1216
1214 1216
1213 1216
1212 1213
1211 1213
1210 1213
1209 1210
1208 1210
1207 1210
1206 1207
1205 1207
1204 1207
1203 1204
1202 1204
1201 1204
1200 1201
1199 1201
1198 1201
1197 1198
1196 1198
1195 1198
1194 1195
1193 1195
1192 1195
1191 1192
1190 1...

result:

ok 

Test #40:

score: 0
Accepted
time: 20ms
memory: 47228kb

input:

1275 7
1 2 2 10 48 11 39 18

output:

1274 12159175
1274 1275
1273 1274
1272 1273
1271 1273
1270 1273
1269 1273
1268 1273
1267 1273
1266 1267
1265 1267
1264 1267
1263 1267
1262 1267
1261 1267
1260 1261
1259 1261
1258 1261
1257 1261
1256 1261
1255 1261
1254 1255
1253 1255
1252 1255
1251 1255
1250 1255
1249 1255
1248 1249
1247 1249
1246 1...

result:

ok 

Test #41:

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

input:

1204 6
42 39 31 45 1 45 15

output:

1203 20981458
1203 1204
1202 1203
1201 1203
1200 1201
1199 1201
1198 1201
1197 1198
1196 1198
1195 1198
1194 1195
1193 1195
1192 1195
1191 1192
1190 1192
1189 1192
1188 1189
1187 1189
1186 1189
1185 1186
1184 1186
1183 1186
1182 1183
1181 1183
1180 1183
1179 1180
1178 1180
1177 1180
1176 1177
1175 1...

result:

ok 

Test #42:

score: 0
Accepted
time: 17ms
memory: 49192kb

input:

1433 6
36 45 32 28 2 47 35

output:

1432 27559374
1432 1433
1431 1432
1430 1431
1429 1431
1428 1429
1427 1429
1426 1427
1425 1427
1424 1425
1423 1425
1422 1423
1421 1423
1420 1421
1419 1421
1418 1419
1417 1419
1416 1417
1415 1417
1414 1415
1413 1415
1412 1413
1411 1413
1410 1411
1409 1411
1408 1409
1407 1409
1406 1407
1405 1407
1404 1...

result:

ok 

Test #43:

score: 0
Accepted
time: 19ms
memory: 50772kb

input:

1479 4
19 20 14 40 48

output:

1478 13245633
1478 1479
1477 1478
1476 1477
1475 1477
1474 1477
1473 1477
1472 1473
1471 1473
1470 1473
1469 1473
1468 1469
1467 1469
1466 1469
1465 1469
1464 1465
1463 1465
1462 1465
1461 1465
1460 1461
1459 1461
1458 1461
1457 1461
1456 1457
1455 1457
1454 1457
1453 1457
1452 1453
1451 1453
1450 1...

result:

ok 

Test #44:

score: 0
Accepted
time: 26ms
memory: 50244kb

input:

1416 5
13 30 1 3 23 37

output:

1415 20881768
1415 1416
1414 1415
1413 1414
1412 1414
1411 1414
1410 1411
1409 1411
1408 1411
1407 1408
1406 1408
1405 1408
1404 1405
1403 1405
1402 1405
1401 1402
1400 1402
1399 1402
1398 1399
1397 1399
1396 1399
1395 1396
1394 1396
1393 1396
1392 1393
1391 1393
1390 1393
1389 1390
1388 1390
1387 1...

result:

ok 

Test #45:

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

input:

1366 2
23 7 45

output:

1365 2381528
1365 1366
1364 1365
1363 1365
1362 1365
1361 1365
1360 1365
1359 1365
1358 1365
1357 1365
1356 1365
1355 1365
1354 1365
1353 1365
1352 1365
1351 1365
1350 1365
1349 1365
1348 1365
1347 1365
1346 1365
1345 1365
1344 1365
1343 1365
1342 1365
1341 1365
1340 1365
1339 1365
1338 1365
1337 13...

result:

ok 

Test #46:

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

input:

69 8
9 37 11 27 24 20 26 29 34

output:

68 1060969
68 69
67 68
66 67
65 67
64 67
63 64
62 64
61 64
60 61
59 61
58 61
57 58
56 58
55 58
54 55
53 55
52 55
51 52
50 52
49 52
48 49
47 49
46 49
45 46
44 46
43 46
42 43
41 43
40 43
39 40
38 40
37 40
36 37
35 37
34 37
33 34
32 34
31 34
30 31
29 31
28 31
27 28
26 28
25 28
24 25
23 25
22 25
21 22
2...

result:

ok 

Test #47:

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

input:

1446 1
31 40

output:

1445 160426
1445 1446
1444 1445
1443 1444
1442 1443
1441 1442
1440 1441
1439 1440
1438 1439
1437 1438
1436 1437
1435 1436
1434 1435
1433 1434
1432 1433
1431 1432
1430 1431
1429 1430
1428 1429
1427 1428
1426 1427
1425 1426
1424 1425
1423 1424
1422 1423
1421 1422
1420 1421
1419 1420
1418 1419
1417 141...

result:

ok 

Test #48:

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

input:

1558 7
1 20 1 18 19 32 23 31

output:

1557 27375776
1557 1558
1556 1557
1555 1557
1554 1555
1553 1555
1552 1553
1551 1553
1550 1551
1549 1551
1548 1549
1547 1549
1546 1547
1545 1547
1544 1545
1543 1545
1542 1543
1541 1543
1540 1541
1539 1541
1538 1539
1537 1539
1536 1537
1535 1537
1534 1535
1533 1535
1532 1533
1531 1533
1530 1531
1529 1...

result:

ok 

Test #49:

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

input:

1506 6
13 11 47 4 16 12 23

output:

1505 26313135
1505 1506
1504 1505
1503 1504
1502 1504
1501 1504
1500 1501
1499 1501
1498 1501
1497 1498
1496 1498
1495 1498
1494 1495
1493 1495
1492 1495
1491 1492
1490 1492
1489 1492
1488 1489
1487 1489
1486 1489
1485 1486
1484 1486
1483 1486
1482 1483
1481 1483
1480 1483
1479 1480
1478 1480
1477 1...

result:

ok 

Test #50:

score: 0
Accepted
time: 23ms
memory: 49416kb

input:

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

output:

1501 30324390
1501 1502
1500 1501
1499 1501
1498 1499
1497 1499
1496 1497
1495 1497
1494 1495
1493 1495
1492 1493
1491 1493
1490 1491
1489 1491
1488 1489
1487 1489
1486 1487
1485 1487
1484 1485
1483 1485
1482 1483
1481 1483
1480 1481
1479 1481
1478 1479
1477 1479
1476 1477
1475 1477
1474 1475
1473 1...

result:

ok 

Test #51:

score: 0
Accepted
time: 24ms
memory: 50256kb

input:

1554 6
40 26 7 34 32 25 10

output:

1553 17872648
1553 1554
1552 1553
1551 1553
1550 1551
1549 1551
1548 1551
1547 1551
1546 1551
1545 1546
1544 1546
1543 1546
1542 1546
1541 1546
1540 1541
1539 1541
1538 1541
1537 1541
1536 1541
1535 1536
1534 1536
1533 1536
1532 1536
1531 1536
1530 1531
1529 1531
1528 1531
1527 1531
1526 1531
1525 1...

result:

ok 

Test #52:

score: 0
Accepted
time: 30ms
memory: 51376kb

input:

1641 6
4 4 50 32 36 21 45

output:

1640 34686354
1640 1641
1639 1640
1638 1639
1637 1639
1636 1637
1635 1637
1634 1635
1633 1635
1632 1633
1631 1633
1630 1631
1629 1631
1628 1629
1627 1629
1626 1627
1625 1627
1624 1625
1623 1625
1622 1623
1621 1623
1620 1621
1619 1621
1618 1619
1617 1619
1616 1617
1615 1617
1614 1615
1613 1615
1612 1...

result:

ok 

Test #53:

score: 0
Accepted
time: 30ms
memory: 52804kb

input:

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

output:

1703 33186050
1703 1704
1702 1703
1701 1703
1700 1701
1699 1701
1698 1699
1697 1699
1696 1697
1695 1697
1694 1695
1693 1695
1692 1693
1691 1693
1690 1691
1689 1691
1688 1689
1687 1689
1686 1687
1685 1687
1684 1685
1683 1685
1682 1683
1681 1683
1680 1681
1679 1681
1678 1679
1677 1679
1676 1677
1675 1...

result:

ok 

Test #54:

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

input:

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

output:

1728 28886428
1728 1729
1727 1728
1726 1727
1725 1726
1724 1725
1723 1724
1722 1723
1721 1722
1720 1721
1719 1720
1718 1719
1717 1718
1716 1717
1715 1716
1714 1715
1713 1714
1712 1713
1711 1712
1710 1711
1709 1710
1708 1709
1707 1708
1706 1707
1705 1706
1704 1705
1703 1704
1702 1703
1701 1702
1700 1...

result:

ok 

Test #55:

score: 0
Accepted
time: 33ms
memory: 52136kb

input:

1674 8
46 26 8 27 50 42 16 8 14

output:

1673 24479277
1673 1674
1672 1673
1671 1672
1670 1672
1669 1672
1668 1669
1667 1669
1666 1669
1665 1666
1664 1666
1663 1666
1662 1663
1661 1663
1660 1663
1659 1660
1658 1660
1657 1660
1656 1657
1655 1657
1654 1657
1653 1654
1652 1654
1651 1654
1650 1651
1649 1651
1648 1651
1647 1648
1646 1648
1645 1...

result:

ok 

Test #56:

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

input:

1791 5
2 4 36 30 27 46

output:

1790 33867308
1790 1791
1789 1790
1788 1789
1787 1789
1786 1789
1785 1786
1784 1786
1783 1786
1782 1783
1781 1783
1780 1783
1779 1780
1778 1780
1777 1780
1776 1777
1775 1777
1774 1777
1773 1774
1772 1774
1771 1774
1770 1771
1769 1771
1768 1771
1767 1768
1766 1768
1765 1768
1764 1765
1763 1765
1762 1...

result:

ok 

Test #57:

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

input:

219 6
11 26 45 49 10 1 14

output:

218 3123505
218 219
217 218
216 217
215 217
214 217
213 217
212 213
211 213
210 213
209 213
208 209
207 209
206 209
205 209
204 205
203 205
202 205
201 205
200 201
199 201
198 201
197 201
196 197
195 197
194 197
193 197
192 193
191 193
190 193
189 193
188 189
187 189
186 189
185 189
184 185
183 185
...

result:

ok 

Test #58:

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

input:

1774 3
39 29 31 6

output:

1773 5370690
1773 1774
1772 1773
1771 1773
1770 1773
1769 1773
1768 1773
1767 1773
1766 1773
1765 1773
1764 1765
1763 1765
1762 1765
1761 1765
1760 1765
1759 1765
1758 1765
1757 1765
1756 1765
1755 1765
1754 1765
1753 1765
1752 1765
1751 1765
1750 1765
1749 1765
1748 1765
1747 1765
1746 1747
1745 17...

result:

ok 

Test #59:

score: 0
Accepted
time: 24ms
memory: 53348kb

input:

1830 6
25 31 32 37 2 1 43

output:

1829 30462134
1829 1830
1828 1829
1827 1829
1826 1827
1825 1827
1824 1825
1823 1825
1822 1823
1821 1823
1820 1821
1819 1821
1818 1819
1817 1819
1816 1817
1815 1817
1814 1815
1813 1815
1812 1813
1811 1813
1810 1811
1809 1811
1808 1809
1807 1809
1806 1807
1805 1807
1804 1805
1803 1805
1802 1803
1801 1...

result:

ok 

Test #60:

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

input:

1886 5
36 33 10 5 16 31

output:

1885 23079262
1885 1886
1884 1885
1883 1885
1882 1885
1881 1882
1880 1882
1879 1882
1878 1879
1877 1879
1876 1879
1875 1876
1874 1876
1873 1876
1872 1873
1871 1873
1870 1873
1869 1870
1868 1870
1867 1870
1866 1867
1865 1867
1864 1867
1863 1864
1862 1864
1861 1864
1860 1861
1859 1861
1858 1861
1857 1...

result:

ok 

Test #61:

score: 0
Accepted
time: 23ms
memory: 54964kb

input:

1907 7
9 37 49 23 34 14 29 24

output:

1906 20753757
1906 1907
1905 1906
1904 1905
1903 1905
1902 1903
1901 1903
1900 1901
1899 1901
1898 1899
1897 1899
1896 1897
1895 1897
1894 1895
1893 1895
1892 1893
1891 1893
1890 1891
1889 1891
1888 1889
1887 1889
1886 1887
1885 1887
1884 1885
1883 1885
1882 1883
1881 1883
1880 1881
1879 1881
1878 1...

result:

ok 

Test #62:

score: 0
Accepted
time: 23ms
memory: 54484kb

input:

1840 2
30 14 7

output:

1839 1289412
1839 1840
1838 1839
1837 1839
1836 1839
1835 1839
1834 1839
1833 1839
1832 1839
1831 1839
1830 1839
1829 1839
1828 1839
1827 1839
1826 1839
1825 1839
1824 1839
1823 1839
1822 1839
1821 1839
1820 1839
1819 1839
1818 1839
1817 1839
1816 1839
1815 1839
1814 1839
1813 1839
1812 1839
1811 18...

result:

ok 

Test #63:

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

input:

1845 3
46 42 35 46

output:

1844 10496398
1844 1845
1843 1844
1842 1844
1841 1844
1840 1844
1839 1844
1838 1844
1837 1844
1836 1837
1835 1837
1834 1837
1833 1837
1832 1837
1831 1837
1830 1837
1829 1837
1828 1837
1827 1828
1826 1828
1825 1828
1824 1828
1823 1828
1822 1828
1821 1828
1820 1828
1819 1828
1818 1819
1817 1819
1816 1...

result:

ok 

Test #64:

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

input:

2029 2
41 7 2

output:

2028 808537
2028 2029
2027 2028
2026 2028
2025 2028
2024 2028
2023 2028
2022 2028
2021 2028
2020 2028
2019 2028
2018 2028
2017 2028
2016 2028
2015 2028
2014 2028
2013 2028
2012 2028
2011 2028
2010 2028
2009 2028
2008 2028
2007 2028
2006 2028
2005 2028
2004 2028
2003 2028
2002 2028
2001 2028
2000 202...

result:

ok 

Test #65:

score: 0
Accepted
time: 33ms
memory: 57220kb

input:

2084 7
40 34 44 27 31 24 50 14

output:

2083 37527190
2083 2084
2082 2083
2081 2083
2080 2083
2079 2080
2078 2080
2077 2080
2076 2077
2075 2077
2074 2077
2073 2074
2072 2074
2071 2074
2070 2071
2069 2071
2068 2071
2067 2068
2066 2068
2065 2068
2064 2065
2063 2065
2062 2065
2061 2062
2060 2062
2059 2062
2058 2059
2057 2059
2056 2059
2055 2...

result:

ok 

Test #66:

score: 0
Accepted
time: 35ms
memory: 56492kb

input:

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

output:

2001 74458404
2001 2002
2000 2001
1999 2000
1998 1999
1997 1998
1996 1997
1995 1996
1994 1995
1993 1994
1992 1993
1991 1992
1990 1991
1989 1990
1988 1989
1987 1988
1986 1987
1985 1986
1984 1985
1983 1984
1982 1983
1981 1982
1980 1981
1979 1980
1978 1979
1977 1978
1976 1977
1975 1976
1974 1975
1973 1...

result:

ok 

Test #67:

score: 0
Accepted
time: 29ms
memory: 55008kb

input:

2013 6
40 34 25 24 15 45 29

output:

2012 35161186
2012 2013
2011 2012
2010 2012
2009 2010
2008 2010
2007 2008
2006 2008
2005 2008
2004 2005
2003 2005
2002 2005
2001 2002
2000 2002
1999 2002
1998 1999
1997 1999
1996 1999
1995 1996
1994 1996
1993 1996
1992 1993
1991 1993
1990 1993
1989 1990
1988 1990
1987 1990
1986 1987
1985 1987
1984 1...

result:

ok 

Test #68:

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

input:

199 5
17 8 15 42 48 4

output:

198 2382209
198 199
197 198
196 197
195 197
194 197
193 197
192 193
191 193
190 193
189 193
188 189
187 189
186 189
185 189
184 185
183 185
182 185
181 185
180 181
179 181
178 181
177 181
176 177
175 177
174 177
173 177
172 173
171 173
170 173
169 173
168 169
167 169
166 169
165 169
164 165
163 165
...

result:

ok 

Test #69:

score: 0
Accepted
time: 29ms
memory: 54608kb

input:

1966 7
37 19 37 24 32 9 37 14

output:

1965 29203766
1965 1966
1964 1965
1963 1964
1962 1963
1961 1963
1960 1963
1959 1960
1958 1960
1957 1960
1956 1957
1955 1957
1954 1957
1953 1954
1952 1954
1951 1954
1950 1951
1949 1951
1948 1951
1947 1948
1946 1948
1945 1948
1944 1945
1943 1945
1942 1945
1941 1942
1940 1942
1939 1942
1938 1939
1937 1...

result:

ok 

Test #70:

score: 0
Accepted
time: 58ms
memory: 57596kb

input:

2211 5
49 7 4 27 10 6

output:

2210 15935989
2210 2211
2209 2210
2208 2209
2207 2209
2206 2209
2205 2209
2204 2205
2203 2205
2202 2205
2201 2205
2200 2201
2199 2201
2198 2201
2197 2201
2196 2197
2195 2197
2194 2197
2193 2197
2192 2193
2191 2193
2190 2193
2189 2193
2188 2189
2187 2189
2186 2189
2185 2189
2184 2185
2183 2185
2182 2...

result:

ok 

Test #71:

score: 0
Accepted
time: 43ms
memory: 57768kb

input:

2187 7
33 36 31 49 29 15 43 18

output:

2186 21094741
2186 2187
2185 2186
2184 2185
2183 2185
2182 2183
2181 2183
2180 2181
2179 2181
2178 2179
2177 2179
2176 2177
2175 2177
2174 2175
2173 2175
2172 2173
2171 2173
2170 2171
2169 2171
2168 2169
2167 2169
2166 2167
2165 2167
2164 2165
2163 2165
2162 2163
2161 2163
2160 2161
2159 2161
2158 2...

result:

ok 

Test #72:

score: 0
Accepted
time: 46ms
memory: 56932kb

input:

2155 6
20 28 43 19 45 19 40

output:

2154 41581356
2154 2155
2153 2154
2152 2153
2151 2153
2150 2151
2149 2151
2148 2149
2147 2149
2146 2147
2145 2147
2144 2145
2143 2145
2142 2143
2141 2143
2140 2141
2139 2141
2138 2139
2137 2139
2136 2137
2135 2137
2134 2135
2133 2135
2132 2133
2131 2133
2130 2131
2129 2131
2128 2129
2127 2129
2126 2...

result:

ok 

Test #73:

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

input:

2116 8
15 11 9 46 41 24 2 17 37

output:

2115 57657640
2115 2116
2114 2115
2113 2115
2112 2113
2111 2113
2110 2111
2109 2111
2108 2109
2107 2109
2106 2107
2105 2107
2104 2105
2103 2105
2102 2103
2101 2103
2100 2101
2099 2101
2098 2099
2097 2099
2096 2097
2095 2097
2094 2095
2093 2095
2092 2093
2091 2093
2090 2091
2089 2091
2088 2089
2087 2...

result:

ok 

Test #74:

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

input:

2235 4
46 43 36 45 46

output:

2234 20192476
2234 2235
2233 2234
2232 2233
2231 2233
2230 2233
2229 2233
2228 2229
2227 2229
2226 2229
2225 2229
2224 2225
2223 2225
2222 2225
2221 2225
2220 2221
2219 2221
2218 2221
2217 2221
2216 2217
2215 2217
2214 2217
2213 2217
2212 2213
2211 2213
2210 2213
2209 2213
2208 2209
2207 2209
2206 2...

result:

ok 

Test #75:

score: 0
Accepted
time: 53ms
memory: 60828kb

input:

2386 6
33 46 3 3 36 47 3

output:

2385 23421354
2385 2386
2384 2385
2383 2385
2382 2385
2381 2385
2380 2381
2379 2381
2378 2381
2377 2381
2376 2377
2375 2377
2374 2377
2373 2377
2372 2373
2371 2373
2370 2373
2369 2373
2368 2369
2367 2369
2366 2369
2365 2369
2364 2365
2363 2365
2362 2365
2361 2365
2360 2361
2359 2361
2358 2361
2357 2...

result:

ok 

Test #76:

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

input:

2256 5
44 29 21 9 14 34

output:

2255 32619088
2255 2256
2254 2255
2253 2255
2252 2255
2251 2252
2250 2252
2249 2252
2248 2249
2247 2249
2246 2249
2245 2249
2244 2245
2243 2245
2242 2245
2241 2245
2240 2241
2239 2241
2238 2241
2237 2241
2236 2237
2235 2237
2234 2237
2233 2237
2232 2233
2231 2233
2230 2233
2229 2233
2228 2229
2227 2...

result:

ok 

Test #77:

score: 0
Accepted
time: 44ms
memory: 58872kb

input:

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

output:

2261 84490692
2261 2262
2260 2261
2259 2260
2258 2259
2257 2258
2256 2257
2255 2256
2254 2255
2253 2254
2252 2253
2251 2252
2250 2251
2249 2250
2248 2249
2247 2248
2246 2247
2245 2246
2244 2245
2243 2244
2242 2243
2241 2242
2240 2241
2239 2240
2238 2239
2237 2238
2236 2237
2235 2236
2234 2235
2233 2...

result:

ok 

Test #78:

score: 0
Accepted
time: 35ms
memory: 57964kb

input:

2257 7
26 17 20 30 32 11 41 13

output:

2256 35113744
2256 2257
2255 2256
2254 2256
2253 2256
2252 2253
2251 2253
2250 2253
2249 2250
2248 2250
2247 2250
2246 2247
2245 2247
2244 2247
2243 2244
2242 2244
2241 2244
2240 2241
2239 2241
2238 2241
2237 2238
2236 2238
2235 2238
2234 2235
2233 2235
2232 2235
2231 2232
2230 2232
2229 2232
2228 2...

result:

ok 

Test #79:

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

input:

226 8
34 21 19 16 21 28 2 37 39

output:

225 5680290
225 226
224 225
223 225
222 223
221 223
220 221
219 221
218 219
217 219
216 217
215 217
214 215
213 215
212 213
211 213
210 211
209 211
208 209
207 209
206 207
205 207
204 205
203 205
202 203
201 203
200 201
199 201
198 199
197 199
196 197
195 197
194 195
193 195
192 193
191 193
190 191
...

result:

ok 

Test #80:

score: 0
Accepted
time: 69ms
memory: 58736kb

input:

2331 5
36 50 29 20 5 29

output:

2330 25841563
2330 2331
2329 2330
2328 2330
2327 2330
2326 2327
2325 2327
2324 2327
2323 2324
2322 2324
2321 2324
2320 2321
2319 2321
2318 2321
2317 2318
2316 2318
2315 2318
2314 2315
2313 2315
2312 2315
2311 2312
2310 2312
2309 2312
2308 2309
2307 2309
2306 2309
2305 2306
2304 2306
2303 2306
2302 2...

result:

ok 

Test #81:

score: 0
Accepted
time: 59ms
memory: 61320kb

input:

2454 6
34 22 1 23 44 1 27

output:

2453 29880376
2453 2454
2452 2453
2451 2453
2450 2451
2449 2451
2448 2449
2447 2449
2446 2447
2445 2447
2444 2445
2443 2445
2442 2443
2441 2443
2440 2441
2439 2441
2438 2439
2437 2439
2436 2437
2435 2437
2434 2435
2433 2435
2432 2433
2431 2433
2430 2431
2429 2431
2428 2429
2427 2429
2426 2427
2425 2...

result:

ok 

Test #82:

score: 0
Accepted
time: 65ms
memory: 61352kb

input:

2493 1
6 37

output:

2492 199366
2492 2493
2491 2492
2490 2491
2489 2490
2488 2489
2487 2488
2486 2487
2485 2486
2484 2485
2483 2484
2482 2483
2481 2482
2480 2481
2479 2480
2478 2479
2477 2478
2476 2477
2475 2476
2474 2475
2473 2474
2472 2473
2471 2472
2470 2471
2469 2470
2468 2469
2467 2468
2466 2467
2465 2466
2464 246...

result:

ok 

Test #83:

score: 0
Accepted
time: 72ms
memory: 60436kb

input:

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

output:

2448 85378953
2448 2449
2447 2448
2446 2447
2445 2446
2444 2445
2443 2444
2442 2443
2441 2442
2440 2441
2439 2440
2438 2439
2437 2438
2436 2437
2435 2436
2434 2435
2433 2434
2432 2433
2431 2432
2430 2431
2429 2430
2428 2429
2427 2428
2426 2427
2425 2426
2424 2425
2423 2424
2422 2423
2421 2422
2420 2...

result:

ok 

Test #84:

score: 0
Accepted
time: 56ms
memory: 61324kb

input:

2424 4
26 19 47 14 30

output:

2423 21435242
2423 2424
2422 2423
2421 2423
2420 2421
2419 2421
2418 2421
2417 2421
2416 2421
2415 2416
2414 2416
2413 2416
2412 2416
2411 2416
2410 2411
2409 2411
2408 2411
2407 2411
2406 2411
2405 2406
2404 2406
2403 2406
2402 2406
2401 2406
2400 2401
2399 2401
2398 2401
2397 2401
2396 2401
2395 2...

result:

ok 

Test #85:

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

input:

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

output:

2509 68458826
2509 2510
2508 2509
2507 2508
2506 2507
2505 2506
2504 2505
2503 2504
2502 2503
2501 2502
2500 2501
2499 2500
2498 2499
2497 2498
2496 2497
2495 2496
2494 2495
2493 2494
2492 2493
2491 2492
2490 2491
2489 2490
2488 2489
2487 2488
2486 2487
2485 2486
2484 2485
2483 2484
2482 2483
2481 2...

result:

ok 

Test #86:

score: 0
Accepted
time: 63ms
memory: 63424kb

input:

2600 4
16 19 18 19 49

output:

2599 22021756
2599 2600
2598 2599
2597 2599
2596 2597
2595 2597
2594 2597
2593 2597
2592 2593
2591 2593
2590 2593
2589 2593
2588 2589
2587 2589
2586 2589
2585 2589
2584 2585
2583 2585
2582 2585
2581 2585
2580 2581
2579 2581
2578 2581
2577 2581
2576 2577
2575 2577
2574 2577
2573 2577
2572 2573
2571 2...

result:

ok 

Test #87:

score: 0
Accepted
time: 80ms
memory: 63700kb

input:

2695 7
25 39 43 5 29 2 49 24

output:

2694 43794209
2694 2695
2693 2694
2692 2693
2691 2693
2690 2691
2689 2691
2688 2689
2687 2689
2686 2687
2685 2687
2684 2685
2683 2685
2682 2683
2681 2683
2680 2681
2679 2681
2678 2679
2677 2679
2676 2677
2675 2677
2674 2675
2673 2675
2672 2673
2671 2673
2670 2671
2669 2671
2668 2669
2667 2669
2666 2...

result:

ok 

Test #88:

score: 0
Accepted
time: 68ms
memory: 62384kb

input:

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

output:

2660 107006823
2660 2661
2659 2660
2658 2659
2657 2658
2656 2657
2655 2656
2654 2655
2653 2654
2652 2653
2651 2652
2650 2651
2649 2650
2648 2649
2647 2648
2646 2647
2645 2646
2644 2645
2643 2644
2642 2643
2641 2642
2640 2641
2639 2640
2638 2639
2637 2638
2636 2637
2635 2636
2634 2635
2633 2634
2632 ...

result:

ok 

Test #89:

score: 0
Accepted
time: 74ms
memory: 62256kb

input:

2626 7
40 5 15 8 28 13 22 12

output:

2625 63314782
2625 2626
2624 2625
2623 2625
2622 2623
2621 2623
2620 2621
2619 2621
2618 2619
2617 2619
2616 2617
2615 2617
2614 2615
2613 2615
2612 2613
2611 2613
2610 2611
2609 2611
2608 2609
2607 2609
2606 2607
2605 2607
2604 2605
2603 2605
2602 2603
2601 2603
2600 2601
2599 2601
2598 2599
2597 2...

result:

ok 

Test #90:

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

input:

255 4
11 1 4 13 42

output:

254 2896197
254 255
253 254
252 254
251 254
250 251
249 251
248 251
247 251
246 251
245 246
244 246
243 246
242 246
241 246
240 241
239 241
238 241
237 241
236 241
235 236
234 236
233 236
232 236
231 236
230 231
229 231
228 231
227 231
226 231
225 226
224 226
223 226
222 226
221 226
220 221
219 221
...

result:

ok 

Test #91:

score: 0
Accepted
time: 56ms
memory: 62760kb

input:

2563 7
40 13 13 37 28 21 8 24

output:

2562 35788764
2562 2563
2561 2562
2560 2562
2559 2562
2558 2559
2557 2559
2556 2559
2555 2556
2554 2556
2553 2556
2552 2553
2551 2553
2550 2553
2549 2550
2548 2550
2547 2550
2546 2547
2545 2547
2544 2547
2543 2544
2542 2544
2541 2544
2540 2541
2539 2541
2538 2541
2537 2538
2536 2538
2535 2538
2534 2...

result:

ok 

Test #92:

score: 0
Accepted
time: 84ms
memory: 64632kb

input:

2768 8
25 18 26 34 13 30 47 6 47

output:

2767 48164850
2767 2768
2766 2767
2765 2766
2764 2765
2763 2764
2762 2763
2761 2762
2760 2761
2759 2760
2758 2759
2757 2758
2756 2757
2755 2756
2754 2755
2753 2754
2752 2753
2751 2752
2750 2751
2749 2750
2748 2749
2747 2748
2746 2747
2745 2746
2744 2745
2743 2744
2742 2743
2741 2742
2740 2741
2739 2...

result:

ok 

Test #93:

score: 0
Accepted
time: 94ms
memory: 65448kb

input:

2757 8
31 36 12 14 35 43 44 19 21

output:

2756 65276248
2756 2757
2755 2756
2754 2755
2753 2755
2752 2753
2751 2753
2750 2751
2749 2751
2748 2749
2747 2749
2746 2747
2745 2747
2744 2745
2743 2745
2742 2743
2741 2743
2740 2741
2739 2741
2738 2739
2737 2739
2736 2737
2735 2737
2734 2735
2733 2735
2732 2733
2731 2733
2730 2731
2729 2731
2728 2...

result:

ok 

Test #94:

score: 0
Accepted
time: 81ms
memory: 64640kb

input:

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

output:

2738 113605339
2738 2739
2737 2738
2736 2737
2735 2736
2734 2735
2733 2734
2732 2733
2731 2732
2730 2731
2729 2730
2728 2729
2727 2728
2726 2727
2725 2726
2724 2725
2723 2724
2722 2723
2721 2722
2720 2721
2719 2720
2718 2719
2717 2718
2716 2717
2715 2716
2714 2715
2713 2714
2712 2713
2711 2712
2710 ...

result:

ok 

Test #95:

score: 0
Accepted
time: 71ms
memory: 64800kb

input:

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

output:

2718 47460972
2718 2719
2717 2718
2716 2717
2715 2716
2714 2715
2713 2714
2712 2713
2711 2712
2710 2711
2709 2710
2708 2709
2707 2708
2706 2707
2705 2706
2704 2705
2703 2704
2702 2703
2701 2702
2700 2701
2699 2700
2698 2699
2697 2698
2696 2697
2695 2696
2694 2695
2693 2694
2692 2693
2691 2692
2690 2...

result:

ok 

Test #96:

score: 0
Accepted
time: 69ms
memory: 64848kb

input:

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

output:

2792 119282398
2792 2793
2791 2792
2790 2791
2789 2790
2788 2789
2787 2788
2786 2787
2785 2786
2784 2785
2783 2784
2782 2783
2781 2782
2780 2781
2779 2780
2778 2779
2777 2778
2776 2777
2775 2776
2774 2775
2773 2774
2772 2773
2771 2772
2770 2771
2769 2770
2768 2769
2767 2768
2766 2767
2765 2766
2764 ...

result:

ok 

Test #97:

score: 0
Accepted
time: 80ms
memory: 65788kb

input:

2879 8
12 7 41 14 5 9 34 25 16

output:

2878 29178860
2878 2879
2877 2878
2876 2877
2875 2876
2874 2875
2873 2874
2872 2873
2871 2872
2870 2871
2869 2870
2868 2869
2867 2868
2866 2867
2865 2866
2864 2865
2863 2864
2862 2863
2861 2862
2860 2861
2859 2860
2858 2859
2857 2858
2856 2857
2855 2856
2854 2855
2853 2854
2852 2853
2851 2852
2850 2...

result:

ok 

Test #98:

score: 0
Accepted
time: 104ms
memory: 66344kb

input:

2997 1
6 29

output:

2996 191750
2996 2997
2995 2996
2994 2995
2993 2994
2992 2993
2991 2992
2990 2991
2989 2990
2988 2989
2987 2988
2986 2987
2985 2986
2984 2985
2983 2984
2982 2983
2981 2982
2980 2981
2979 2980
2978 2979
2977 2978
2976 2977
2975 2976
2974 2975
2973 2974
2972 2973
2971 2972
2970 2971
2969 2970
2968 296...

result:

ok 

Test #99:

score: 0
Accepted
time: 108ms
memory: 66360kb

input:

2993 8
2 50 21 40 45 19 9 36 30

output:

2992 81471772
2992 2993
2991 2992
2990 2991
2989 2991
2988 2989
2987 2989
2986 2987
2985 2987
2984 2985
2983 2985
2982 2983
2981 2983
2980 2981
2979 2981
2978 2979
2977 2979
2976 2977
2975 2977
2974 2975
2973 2975
2972 2973
2971 2973
2970 2971
2969 2971
2968 2969
2967 2969
2966 2967
2965 2967
2964 2...

result:

ok 

Test #100:

score: 0
Accepted
time: 84ms
memory: 66344kb

input:

2993 1
9 45

output:

2992 296217
2992 2993
2991 2992
2990 2991
2989 2990
2988 2989
2987 2988
2986 2987
2985 2986
2984 2985
2983 2984
2982 2983
2981 2982
2980 2981
2979 2980
2978 2979
2977 2978
2976 2977
2975 2976
2974 2975
2973 2974
2972 2973
2971 2972
2970 2971
2969 2970
2968 2969
2967 2968
2966 2967
2965 2966
2964 296...

result:

ok