제출 #675897

#제출 시각아이디문제언어결과실행 시간메모리
675897TangirkulLampice (COCI21_lampice)C++17
50 / 50
1 ms324 KiB
#include<bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back #define sz size #define Junanna ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const ll K = 32; const ll INF = 1e9 + 7; const ll MOD = 1e9 + 7; const ll N = (1e5 + 125); void ma1n () { ll n, k; cin >> n >> k; ll a[n + 7]; for (ll i = 1; i <= n; i++) { cin >> a[i]; } for (ll sze = 1; (sze * k) <= n; sze++) { for (ll l = 1, r = sze * k; r <= n; r++, l++) { ll ok = 0; for (ll ist = 1; ist < k; ist++) { for (ll i = (ist - 1) * sze + 1; i <= ist * sze; i++) { if (a[l + i - 1] != a[sze + l + i - 1]) { ok = 1; break; } } if (ok) { break; } } if (!ok) { cout << sze << "\n"; for (ll i = l; i <= l + sze - 1; i++) { cout << a[i] << " "; } return; } } } cout << -1 << "\n"; } int main () { Junanna; ll t = 1; while (t--) { ma1n (); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...