#include <cstdio>
#include <stdio.h>
#include <stdbool.h>
#include <iostream>
#include <map>
#include <vector>
#include <climits>
#include <stack>
#include <string>
#include <queue>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <cctype>
#include <bitset>
#include <iomanip>
#include <cstring>
#include <numeric>
#include <cassert>
#include <random>
#include <chrono>
#include <fstream>
using namespace std;
#define int long long
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k;
cin>>n>>k;
vector<int> vect(n);
for (int i=0; i<n; ++i)cin>>vect[i];
for (int l=0; l<n; ++l)for (int len=1; len<=n-l; ++len)for (int i=0; i<n; ++i){
int c=0;
for (int j=i; j+len<n; j+=len, ++c)for (int p=0; p<len; ++p)if (vect[j+p]!=vect[l+p])goto end;
end:;
if (c>=k){
cout<<len<<"\n";
for (int j=l; j<l+len; ++j)cout<<vect[j]<<" ";
return 0;
}
}
cout<<-1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |