제출 #499515

#제출 시각아이디문제언어결과실행 시간메모리
499515IbraheemLampice (COCI21_lampice)C++14
50 / 50
1 ms320 KiB
#include <bits/stdc++.h> #define REP(i,a,b) for (auto i = (a); i <= (b); ++i) #define SIZE(x) int(x.size()) #define debug(x) cerr << #x << " is " << x << endl #define el '\n' using namespace std; using ll = long long; int main() { cin.tie(0)->sync_with_stdio(0); int n, k; cin >> n >> k; vector<int> a(n+1); REP(i,1,n) cin >> a[i]; REP(i,1,n) REP(j,i,n) { int x = j+1; bool check = true; REP(z,1,k-1) { for (int cnt = 0; cnt <= j-i; ++cnt, ++x) { if (x > n) { check = false; break; } if (a[x] != a[i+cnt]) { check = false; break; } } if (not check) break; } if (check) { cout << j-i+1 << el; REP(y,i,j) { cout << a[y] << ' '; } return 0; } } cout << -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...