# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1059525 | Thanhs | Lampice (COCI21_lampice) | C++14 | 1 ms | 452 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#define endl '\n'
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define setmin(x, y) x = min((x), (y))
#define setmax(x, y) x = max((x), (y))
#define sqr(x) ((x) * (x))
#define fi first
#define se second
#define all(x) x.begin(), x.end()
// mt19937 hdp(chrono::high_resolution_clock::now().time_since_epoch().count());
// int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);}
const int NM = 50 + 5;
const int LM = 1e4 + 5;
const int mod = 1e9 + 7;
int n, k, a[NM];
bool check(int l, int r)
{
int len = r - l + 1;
for (int i = 1, j = l; i <= k; i++, j += len)
for (int o = 0; o < len; o++)
if (j + o > n || a[j + o] != a[l + o])
return false;
return true;
}
void solve()
{
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 << endl;
for (int i = l; i <= r; i++)
cout << a[i] << ' ';
return;
}
cout << -1;
}
signed main()
{
fastIO
if (fopen("in.txt", "r"))
{
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
}
int tc = 1;
// cin >> tc;
while (tc--)
solve();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |