Submission #237136

#TimeUsernameProblemLanguageResultExecution timeMemory
237136VimmerVođe (COCI17_vode)C++14
120 / 120
561 ms96596 KiB
#include <bits/stdc++.h> using namespace std; int a[5005], f[5005][5005]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) f[(i + 1) % n][m] = (a[i] != a[(i + 1) % n]); for (int j = m - 1; j >= 0; j--) for (int i = 0; i < n; i++) { int nxt = (i + 1) % n, l = j + 1, r = min(j + k, m); bool val = 0; f[i][j] = f[i][j + 1]; if (a[i] != a[nxt]) val = ((f[nxt][l] - f[nxt][r + 1]) != (r - l + 1)); if (a[i] == a[nxt]) val = ((f[nxt][l] - f[nxt][r + 1]) > 0); f[i][j] += val; } for (int i = 0; i < n; i++) if (f[i][1] != f[i][0]) cout << a[i] << " "; else cout << (1 + a[i]) % 2 << " "; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...