QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#469623#2534. LampiceNevll50 ✓0ms4072kbC++14692b2024-07-09 21:11:462024-07-09 21:11:46

Judging History

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

  • [2024-07-09 21:11:46]
  • 评测
  • 测评结果:50
  • 用时:0ms
  • 内存:4072kb
  • [2024-07-09 21:11:46]
  • 提交

answer

# include <bits/stdc++.h>
# define ll long long
# define ld double
# define fi first
# define se second
# define pii pair<int, int>
# define pll pair<ll, ll>
using namespace std;

int main() {
	int N, K;
	scanf("%d %d", &N, &K);
	
	vector<int> arr(N + 1);
	for(int i=1;i<=N;i++) scanf("%d", &arr[i]);
	
	for(int i=K;i<=N;i+=K) {
		for(int c=1;c+i-1<=N;c++) {
			bool ans = 1;
			for(int d=c;d<c+i;d++) {
				if(arr[d] != arr[c + (d - c)%(i / K)]) {
					ans = 0;
					break;
				}
			}
			if(ans) {
				printf("%d\n", i / K);
				for(int d=c;d<c + i /K;d++) printf("%d ", arr[d]);
				printf("\n");
				return 0;
			}
		}
	}
	
	printf("-1\n");
	return 0;
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

44 33
972 609 58 209 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 847 185 323 110 569 436 931

output:

1
175 

result:

ok good solution

Test #2:

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

input:

38 22
156 7 83 283 576 507 703 646 192 865 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 15 707 160 474 773 183

output:

1
766 

result:

ok good solution

Test #3:

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

input:

32 11
882 194 339 996 571 154 166 823 699 336 360 326 326 326 326 326 326 326 326 326 326 326 59 994 884 746 440 192 820 449 370 724

output:

1
326 

result:

ok good solution

Test #4:

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

input:

47 26
518 96 403 489 687 987 923 243 479 908 789 2 908 806 131 661 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 249 60 4 53 543

output:

1
80 

result:

ok good solution

Test #5:

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

input:

47 17
194 167 604 962 41 240 342 680 276 174 901 536 621 925 442 48 364 978 90 697 516 825 103 834 128 263 285 222 942 445 944 944 944 944 944 944 944 944 944 944 944 944 944 944 944 944 944

output:

1
944 

result:

ok good solution

Test #6:

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

input:

39 4
1 5 4 3 1 2 4 3 3 5 5 3 1 2 1 3 4 1 4 2 2 3 4 3 2 3 1 5 1 3 3 3 3 2 4 2 2 1 5

output:

1
3 

result:

ok good solution

Test #7:

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

input:

41 19
4 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 5 1 5 4 1 5 5 5 4 5 5 4 4 1 5 5 5 1 1

output:

1
2 

result:

ok good solution

Test #8:

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

input:

21 4
1 1 4 4 3 5 1 4 2 3 3 3 1 4 2 2 2 2 4 3 3

output:

1
2 

result:

ok good solution

Test #9:

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

input:

9 8
2 2 2 2 2 2 2 2 4

output:

1
2 

result:

ok good solution

Test #10:

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

input:

3 2
4 4 5

output:

1
4 

result:

ok good solution

Subtask #2:

score: 15
Accepted

Test #11:

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

input:

42 2
571 81 841 575 238 608 20 403 644 554 646 544 445 654 324 277 210 599 21 78 205 990 932 600 503 180 581 748 698 853 857 429 88 455 735 540 747 381 480 476 998 975

output:

-1

result:

ok impossible

Test #12:

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

input:

10 2
299 570 208 838 922 908 208 838 922 908

output:

4
208 838 922 908 

result:

ok good solution

Test #13:

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

input:

34 2
848 315 255 320 362 20 159 738 681 442 950 539 106 110 197 739 440 848 315 255 320 362 20 159 738 681 442 950 539 106 110 197 739 440

output:

17
848 315 255 320 362 20 159 738 681 442 950 539 106 110 197 739 440 

result:

ok good solution

Test #14:

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

input:

38 2
602 969 439 307 892 661 668 739 891 136 553 891 136 553 25 562 228 964 510 488 585 615 734 28 979 465 672 772 536 560 666 929 948 959 698 581 217 538

output:

3
891 136 553 

result:

ok good solution

Test #15:

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

input:

38 2
650 760 943 805 659 471 79 602 824 970 954 628 633 293 84 3 325 760 943 805 659 471 79 602 824 970 954 628 633 293 84 3 325 190 800 915 457 195

output:

16
760 943 805 659 471 79 602 824 970 954 628 633 293 84 3 325 

result:

ok good solution

Test #16:

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

input:

50 2
5 5 5 3 4 3 1 2 3 3 1 3 4 3 2 1 4 5 2 4 2 4 1 5 3 2 3 4 3 1 2 3 3 1 3 4 3 2 1 4 5 2 4 2 4 1 5 3 2 1

output:

1
5 

result:

ok good solution

Test #17:

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

input:

50 2
1 4 4 4 2 5 2 4 2 3 5 1 2 1 3 5 3 2 4 1 4 4 4 2 5 2 4 2 3 5 1 2 1 3 5 3 2 4 2 2 1 5 3 4 5 3 4 1 4 3

output:

1
4 

result:

ok good solution

Test #18:

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

input:

50 2
4 3 3 4 2 3 4 2 5 2 2 5 3 5 1 5 1 1 5 2 2 2 2 4 3 3 4 2 3 4 2 5 2 2 5 3 5 1 5 1 1 5 2 2 2 2 3 5 3 4

output:

1
3 

result:

ok good solution

Test #19:

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

input:

50 2
3 5 2 3 4 1 3 4 4 4 4 2 4 1 1 3 4 5 1 5 1 4 2 5 4 4 3 5 2 3 2 4 3 1 3 4 1 2 5 4 5 4 4 4 1 4 4 1 1 2

output:

1
4 

result:

ok good solution

Test #20:

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

input:

50 2
3 5 5 4 2 3 3 1 4 4 3 2 5 5 4 3 1 4 3 2 5 5 4 3 1 4 4 2 1 2 3 4 2 4 5 1 4 1 5 3 1 3 1 1 2 5 2 3 1 3

output:

1
5 

result:

ok good solution

Subtask #3:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #21:

score: 25
Accepted
time: 0ms
memory: 3732kb

input:

21 5
867 72 833 44 956 315 820 805 949 862 147 328 655 298 111 529 615 429 336 422 362

output:

-1

result:

ok impossible

Test #22:

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

input:

34 32
642 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 977

output:

1
742 

result:

ok good solution

Test #23:

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

input:

37 35
796 956 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536 536

output:

1
536 

result:

ok good solution

Test #24:

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

input:

16 9
312 11 690 427 427 964 548 858 858 858 858 858 858 858 858 858

output:

1
858 

result:

ok good solution

Test #25:

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

input:

11 6
748 574 40 978 481 654 654 654 654 654 654

output:

1
654 

result:

ok good solution

Test #26:

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

input:

50 1
2 1 2 2 1 2 5 3 3 5 5 2 2 5 3 3 2 5 3 3 1 5 4 2 1 2 4 2 1 2 3 3 5 5 4 4 4 2 3 5 3 2 3 5 5 3 4 2 3 5

output:

1
2 

result:

ok good solution

Test #27:

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

input:

50 14
3 4 2 5 3 2 5 3 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5 4 3 5

output:

3
4 3 5 

result:

ok good solution

Test #28:

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

input:

50 3
2 4 4 4 3 4 5 5 5 4 4 5 3 2 4 3 4 5 5 5 4 4 5 3 2 4 3 4 5 5 5 4 4 5 3 2 4 3 1 5 4 2 3 5 4 3 1 1 2 5

output:

1
4 

result:

ok good solution

Test #29:

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

input:

50 4
1 2 3 4 2 3 1 2 2 4 3 5 4 3 2 3 1 2 2 4 3 5 4 3 2 3 1 2 2 4 3 5 4 3 2 3 1 2 2 4 3 5 4 3 4 5 4 5 2 1

output:

10
2 3 1 2 2 4 3 5 4 3 

result:

ok good solution

Test #30:

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

input:

50 3
4 5 2 3 1 3 4 2 5 2 3 4 3 4 2 3 4 2 1 3 4 2 5 2 3 4 3 4 2 3 4 2 1 3 4 2 5 2 3 4 3 4 2 3 4 2 3 3 3 1

output:

1
3 

result:

ok good solution

Extra Test:

score: 0
Extra Test Passed