# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
519134 |
2022-01-25T17:54:34 Z |
leaked |
Vođe (COCI17_vode) |
C++14 |
|
380 ms |
24356 KB |
#include <bits/stdc++.h>
#define f first
#define s second
#define m_p make_pair
#define vec vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)(x).size()
#define fast_izho ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pw(x) (1<<(x))
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
template <class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
template <class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
const int N=5001;
bool dp[N][N];
signed main(){
fast_izho;
int n,m,k;
cin>>n>>m>>k;
vec<int>a(n);
for(int i=0;i<n;i++){
cin>>a[i];
// for(int j=m;j>m-k;j--)
// dp[i][j]=1;
}
vec<int> cnt(n);///of ones
for(int j=m-1;j>=0;j--){
for(int i=0;i<n;i++){
int nx=(i+1)%n;
int lo=(cnt[nx]<k?1:0),wi=(cnt[nx]>0?1:0);
dp[i][j]=(a[i]==a[nx]?wi:lo);
// cnt[i]+=dp[i][j];
// cout<<"WIN "<<i<<' '<<j<<' '<<dp[i][j]<<endl;
// cout<<"A "<<dp[i][j]<<' '<<cnt[i]<<endl;
}
for(int i=0;i<n;i++)
cnt[i]+=dp[i][j],cnt[i]-=dp[i][j+k];
}
for(int i=0;i<n;i++){
cout<<(a[i]^dp[i][1]^1)<<' ';
}
return 0;
}
/*
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
588 KB |
Output is correct |
3 |
Correct |
0 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
972 KB |
Output is correct |
2 |
Correct |
1 ms |
716 KB |
Output is correct |
3 |
Correct |
1 ms |
1100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1228 KB |
Output is correct |
2 |
Correct |
1 ms |
1100 KB |
Output is correct |
3 |
Correct |
1 ms |
1232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1612 KB |
Output is correct |
2 |
Correct |
2 ms |
1868 KB |
Output is correct |
3 |
Correct |
2 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2380 KB |
Output is correct |
2 |
Correct |
2 ms |
2252 KB |
Output is correct |
3 |
Correct |
2 ms |
2124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2032 KB |
Output is correct |
2 |
Correct |
4 ms |
2108 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
9108 KB |
Output is correct |
2 |
Correct |
54 ms |
9188 KB |
Output is correct |
3 |
Correct |
336 ms |
23896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
106 ms |
12480 KB |
Output is correct |
2 |
Correct |
303 ms |
23840 KB |
Output is correct |
3 |
Correct |
109 ms |
14028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
380 ms |
24052 KB |
Output is correct |
2 |
Correct |
4 ms |
844 KB |
Output is correct |
3 |
Correct |
3 ms |
576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
361 ms |
24240 KB |
Output is correct |
2 |
Correct |
318 ms |
24312 KB |
Output is correct |
3 |
Correct |
358 ms |
24356 KB |
Output is correct |