Submission #199952

#TimeUsernameProblemLanguageResultExecution timeMemory
199952Osama_AlkhodairyVođe (COCI17_vode)C++17
72 / 120
3096 ms38940 KiB
#include <bits/stdc++.h> using namespace std; #define finish(x) return cout << x << endl, 0 #define ll long long const int N = 5001; int n, m, k, dp[N][N]; vector <int> a; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m >> k; a.resize(n); for(auto &i : a) cin >> i; for(int c = m - 1 ; c >= 1 ; c--){ for(int i = 0 ; i < n ; i++){ for(int j = c + 1 ; j <= min(m, c + k) ; j++){ int k = (i + 1) % n; if(a[i] == a[k] && dp[k][j]) dp[i][c] = 1; if(a[i] != a[k] && dp[k][j] == 0) dp[i][c] = 1; } } } for(int i = 0 ; i < n ; i++){ cout << (dp[i][1] ^ a[i] ^ 1) << " "; } cout << endl; }
#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...