| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1271822 | chanhchuong123 | Lampice (COCI21_lampice) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1010;
int n, k;
int a[MAX];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n >> k;
for (int i = 1; i <= n; ++i)
{
cin >> a[i];
}
for (int i = 1; k * i <= n; ++i)
{
for (int st = 1, en = k * i; en <= n; ++st, ++en)
{
bool flag = true;
for (int lf = st; lf <= en; lf += i)
{
for (int j = 0; j < i; ++j)
{
// cout << st + j << ' ' << lf + j << '\n';
if (a[st + j] != a[lf + j])
{
flag = false;
break;
}
}
}
if (flag)
{
cout << i << '\n';
for (int j = 0; j < i; ++j)
{
cout << a[st + j] << ' ';
}
return 0;
}
}
}
cout << -1;
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
