# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
369211 |
2021-02-20T22:46:41 Z |
Ahmad_Hasan |
Vođe (COCI17_vode) |
C++17 |
|
1265 ms |
141932 KB |
#include <bits/stdc++.h>
#define int int16_t
/**
|||||||||| ||||| ||||| ||||||||||
||||||||||||| ||||| ||||| |||||
|||| |||||| ||||| ||||| |||||
||||||||||||||||| ||||||||||||||| ||||||||||
||||||||||||||||||| ||||||||||||||| |||||
||||| ||||| ||||| ||||| |||||
||||| ||||| ||||| ||||| ||||||||||
AHMED;HASSAN;SAEED;
*/
using namespace std;
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n,m,k;
cin>>n>>m>>k;
int v[n];
for(int i=0;i<n;i++){
cin>>v[i];
}
int dp[n][m+5];
for(int i=0;i<n;i++){
dp[i][m]=0;
}
int cntr[n][m+5][2];
for(int i=0;i<n;i++)
cntr[i][m][0]=1;
for(int j=m-1;j>=0;j--){
for(int i=n-1;i>=0;i--){
if(j==0){
if(cntr[i][j+1][1])
dp[i][j]=1;
else
dp[i][j]=0;
}
else{
if(v[i]==v[((i+1)==n?0:i+1)]){
if(cntr[((i+1)==n?0:i+1)][j+1][1])
dp[i][j]=1;
else
dp[i][j]=0;
}
else{
if(cntr[((i+1)==n?0:i+1)][j+1][1])
dp[i][j]=0;
else
dp[i][j]=1;
}
}
cntr[i][j][0]=cntr[i][j+1][0];
cntr[i][j][1]=cntr[i][j+1][1];
cntr[i][j][dp[i][j]]++;
if(j+k<=m){
cntr[i][j][dp[i][j+k]]--;
}
}
}
for(int i=0;i<n;i++)
cout<<((dp[i][0]==1)?v[i]:!v[i])<<' ';
return 0;
}
/**
6 20 5
1 0 0 1 1 0
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
748 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
2 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
748 KB |
Output is correct |
2 |
Correct |
1 ms |
620 KB |
Output is correct |
3 |
Correct |
2 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1004 KB |
Output is correct |
2 |
Correct |
3 ms |
1132 KB |
Output is correct |
3 |
Correct |
3 ms |
1152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1644 KB |
Output is correct |
2 |
Correct |
4 ms |
1516 KB |
Output is correct |
3 |
Correct |
2 ms |
1260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1516 KB |
Output is correct |
2 |
Correct |
4 ms |
1516 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
136 ms |
17940 KB |
Output is correct |
2 |
Correct |
86 ms |
20076 KB |
Output is correct |
3 |
Correct |
1142 ms |
129388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
196 ms |
42476 KB |
Output is correct |
2 |
Correct |
596 ms |
115436 KB |
Output is correct |
3 |
Correct |
363 ms |
45036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1265 ms |
141932 KB |
Output is correct |
2 |
Correct |
10 ms |
3564 KB |
Output is correct |
3 |
Correct |
4 ms |
2156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1196 ms |
140856 KB |
Output is correct |
2 |
Correct |
1072 ms |
125616 KB |
Output is correct |
3 |
Correct |
709 ms |
139628 KB |
Output is correct |