# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
666265 | Chal1shkan | Lampice (COCI21_lampice) | C++14 | 1 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# include <bits/stdc++.h>
# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define pii pair <int, int>
# define pll pair <ll, ll>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll maxn = 2e6 + 125;
const ll maxl = 20 + 0;
const ll inf = 2e9 + 0;
const ll mod = 998244353;
using namespace std;
void ma1n ()
{
int n, k;
cin >> n >> k;
int a[n + 3];
for (int i = 1; i <= n; ++i)
{
cin >> a[i];
}
for (int pr = 0; pr <= n; ++pr)
{
for (int sf = 0; sf <= n; ++sf)
{
if (pr + sf >= n)
{
continue;
}
else
{
int sz = (n - sf - pr);
if (sz % k == 0)
{
int d = sz / k, cnt = 0;
bool ok = 1, fnd = 0;
vector <int> x, need;
for (int i = 1 + pr; i <= n - sf; ++i)
{
x.pb(a[i]);
cnt++;
if (cnt == d)
{
if (fnd == 0)
{
need = x;
fnd = 1;
}
else
{
if (x != need)
{
ok = 0;
break;
}
}
cnt = 0;
x.clear();
}
}
if (ok)
{
cout << need.size() << nl;
for (int i = 0; i < need.size(); ++i)
{
cout << need[i] << ' ';
}
cout << nl;
return;
}
}
}
}
}
cout << -1 << nl;
}
int main ()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int ttt = 1;
// cin >> ttt;
for (int test = 1; test <= ttt; test++)
{
// cout << "Case " << test << ":" << nl;
ma1n();
}
return 0;
}
컴파일 시 표준 에러 (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... |