This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |