답안 #516284

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
516284 2022-01-21T02:38:29 Z penguinhacker Lampice (COCI21_lampice) C++14
0 / 50
1 ms 296 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

const int mxN=50;
int n, k, a[mxN];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> k;
	for (int i=0; i<n; ++i)
		cin >> a[i];
	for (int i=0; i<n; ++i)
		for (int j=i; j<n; ++j) {
			if ((j-i+1)%k!=0)
				continue;
			int len=(j-i+1)/k;
			bool ok=1;
			for (int k=j; k<=j; ++k)
				ok&=a[k]==a[(k-i)%len+i];
			if (ok) {
				cout << len << "\n";
				for (int k=0; k<len; ++k)
					cout << a[i+k] << " ";
				return 0;
			}
		}
	cout << -1;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Incorrect 0 ms 204 KB Sequence doesn't repeat k times
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Sequence doesn't repeat k times
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Incorrect 0 ms 204 KB Sequence doesn't repeat k times
7 Halted 0 ms 0 KB -