#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 |
1 |
Correct |
4 ms |
380 KB |
Output is correct |
2 |
Correct |
5 ms |
632 KB |
Output is correct |
3 |
Correct |
5 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
1272 KB |
Output is correct |
2 |
Correct |
7 ms |
888 KB |
Output is correct |
3 |
Correct |
16 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
1528 KB |
Output is correct |
2 |
Correct |
16 ms |
1400 KB |
Output is correct |
3 |
Correct |
7 ms |
1528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
1912 KB |
Output is correct |
2 |
Correct |
27 ms |
2352 KB |
Output is correct |
3 |
Correct |
10 ms |
2296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
2912 KB |
Output is correct |
2 |
Correct |
20 ms |
2680 KB |
Output is correct |
3 |
Correct |
50 ms |
2680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
2552 KB |
Output is correct |
2 |
Correct |
26 ms |
2680 KB |
Output is correct |
3 |
Correct |
5 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
231 ms |
16968 KB |
Output is correct |
2 |
Correct |
1063 ms |
18040 KB |
Output is correct |
3 |
Execution timed out |
3079 ms |
37616 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1574 ms |
31772 KB |
Output is correct |
2 |
Execution timed out |
3093 ms |
38008 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3096 ms |
36728 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3087 ms |
38940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |