QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#393962#2534. Lampicelfxxx#50 ✓1ms3944kbC++141.0kb2024-04-19 18:39:562024-07-04 03:36:38

Judging History

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

  • [2024-07-04 03:36:38]
  • 评测
  • 测评结果:50
  • 用时:1ms
  • 内存:3944kb
  • [2024-04-19 18:39:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
bool be;
constexpr int N = 55;
int n, k, a[N];
inline bool check(int l, int r)
{
	int len = r - l + 1, p = r + 1;
	for (int o = 1; o < k; ++o) {
		if (p + len - 1 > n) return 0;
		for (int i = l; i <= r; ++i) {
			if (a[i] != a[p + i - l]) {
				return 0;
			}
		}
		p += len;
	}
	return 1;
}
bool en;
int main() {
	cerr << (&be - &en) / 1024.0 / 1024 << " MB\n--------------------------------" << endl;
#ifdef IAKIOI
	freopen("in.in", "r", stdin);
//	freopen("out.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	for (int l = 1; l <= n; ++l) {
		for (int r = l; r <= n; ++r) {
			if (check(l, r)) {
				cout << r - l + 1 << '\n';
				for (int k = l; k <= r; ++k) cout << a[k] << ' ';
				return 0;
			}
		}
	}
	cout << "-1\n";
	return 0;
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

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

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: 1ms
memory: 3896kb

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: 3904kb

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: 3828kb

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: 3828kb

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: 3764kb

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: 3896kb

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: 3896kb

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: 3892kb

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: 3848kb

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: 3908kb

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: 3892kb

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: 3944kb

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: 3892kb

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: 3836kb

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: 3912kb

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: 3904kb

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:

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

result:

ok good solution

Test #18:

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

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:

23
4 3 3 4 2 3 4 2 5 2 2 5 3 5 1 5 1 1 5 2 2 2 2 

result:

ok good solution

Test #19:

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

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: 3852kb

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: 3892kb

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: 3888kb

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: 3896kb

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: 3848kb

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: 3672kb

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: 3832kb

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: 3900kb

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: 3900kb

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: 3856kb

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: 3900kb

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:

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

result:

ok good solution

Extra Test:

score: 0
Extra Test Passed