| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 666265 | Chal1shkan | Lampice (COCI21_lampice) | C++14 | 1 ms | 340 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>
# 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;
}
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... | ||||
