# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
798998 | Tunglam07 | Lampice (COCI21_lampice) | C++17 | 1 ms | 320 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n, m, a[51];
bool ck=0;
cin >> n >> m;
if(m == 1)
{
cin >> a[0];
cout << 1 << endl;
cout << a[0];
}
else
{ for(int i = 1; i <= n; i++)
{
cin >> a[i];
}
int num=n/m;
for(int i = 1; i <= num; i++)
{
int num1 = n-m*i+1;
for(int j = 1; j <= n-m*i+1; j++)
{
ck = 0;
for(int k = 0; k < m - 1; k++)
{
for(int z = 0; z < i; z++)
{
if(a[j + z + k * i] != a[j + z + (k + 1) * i])
{
ck = 1;
}
}
}
if(!ck)
{
cout << i << endl;
for(int z = 0; z < i; z++)
{
cout << a[j + z] << " ";
}
return 0;
}
}
}
cout << -1;
}
}
Compilation message (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... |