Submission #200192

#TimeUsernameProblemLanguageResultExecution timeMemory
200192SaboonVođe (COCI17_vode)C++14
120 / 120
898 ms106168 KiB
#include <iostream> using namespace std; const int maxn = 5e3 + 500; int dp[maxn][maxn]; int num[2][maxn]; int ani[maxn]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 0; i < n; i++) cin >> ani[i]; // 0 is a sheep, 1 is a goat for (int i = 0; i < n; i++){ dp[i][m - 1] = (ani[i] ^ 1); num[ani[i] ^ 1][i] ++; } for (int j = m - 2; j >= 0; j--){ for (int i = 0; i < n; i++){ int nex = (i + 1) % n; if (num[ani[i]][nex]) dp[i][j] = ani[i]; else dp[i][j] = ani[i] ^ 1; // cout << i << " " << j << " " << dp[i][j] << endl; } for (int i = 0; i < n; i++){ num[dp[i][j]][i] ++; if (j + k < m) num[dp[i][j + k]][i] --; } } for (int i = 0; i < n; i++) cout << dp[i][0] << " "; }
#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...