제출 #510380

#제출 시각아이디문제언어결과실행 시간메모리
510380KoDLampice (COCI21_lampice)C++17
50 / 50
1 ms332 KiB
#include <bits/stdc++.h> using std::vector; using std::array; using std::pair; using std::tuple; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int N, K; std::cin >> N >> K; vector<int> A(N); for (auto& x : A) { std::cin >> x; } for (int l = 0; l < N; ++l) { for (int k = 1; l + k * K <= N; ++k) { bool ok = true; for (int i = 0; i < K; ++i) { for (int j = 0; j < k; ++j) { if (A[l + j] != A[l + i * k + j]) { ok = false; } } } if (ok) { std::cout << k << '\n'; for (int j = 0; j < k; ++j) { std::cout << A[l + j] << " \n"[j + 1 == k]; } return 0; } } } std::cout << -1 << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...