Submission #497670

#TimeUsernameProblemLanguageResultExecution timeMemory
497670hgmhcLampice (COCI21_lampice)C++17
50 / 50
1 ms204 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...