# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
368332 |
2021-02-19T22:34:03 Z |
Ahmad_Hasan |
Vođe (COCI17_vode) |
C++17 |
|
3000 ms |
189036 KB |
#include <bits/stdc++.h>
#define int long long
/**
|||||||||| ||||| ||||| ||||||||||
||||||||||||| ||||| ||||| |||||
|||| |||||| ||||| ||||| |||||
||||||||||||||||| ||||||||||||||| ||||||||||
||||||||||||||||||| ||||||||||||||| |||||
||||| ||||| ||||| ||||| |||||
||||| ||||| ||||| ||||| ||||||||||
AHMED;HASSAN;SAEED;
*/
using namespace std;
int32_t main()
{
/**freopen("movie.in","r",stdin);
freopen("movie.out","w",stdout);*/
int n,m,k;
cin>>n>>m>>k;
vector<int>v(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
int dp[n+5][m+5];
memset(dp,-1,sizeof(dp));
for(int i=0;i<n;i++)
dp[i][m]=0;
for(int j=m;j>=0;j--){
for(int i=n-1;i>=0;i--){
for(int z=1;z<=k;z++){
if(z+j<=m){
if(j==0)
dp[i][j]=max(dp[i][j],dp[(i)%n][j+z]);
else
dp[i][j]=max(dp[i][j],(v[i]!=v[(i+1)%n])-dp[(i+1)%n][j+z]);
}
}
}
}
/**
for(int i=0;i<n;i++){
for(int j=0;j<=m;j++){
cout<<dp[i][j]<<' ';
}
cout<<'\n';
}
*/
for(int i=0;i<n;i++)
cout<<((dp[i][0]==1)?v[i]:!v[i])<<' ';
return 0;
}
/**
4 3
100000000000 200000000000 300000000000 400000000000 800000000000 1000000000000 2000000000000
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
1004 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
876 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
1292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
2028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
1900 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
479 ms |
23788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3093 ms |
56428 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3060 ms |
189036 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3059 ms |
187756 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |