# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199945 | mohammedehab2002 | Vođe (COCI17_vode) | C++11 | 357 ms | 291960 KiB |
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;
int a[5005],dp[5005][5005],nex[2][5005][5005];
int main()
{
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
for (int i=0;i<n;i++)
scanf("%d",&a[i]);
m--;
for (int i=0;i<n;i++)
{
nex[0][m][i]=m;
nex[1][m][i]=1e9;
}
for (int i=m-1;i>=0;i--)
{
for (int j=0;j<n;j++)
{
nex[0][i][j]=nex[0][i+1][j];
nex[1][i][j]=nex[1][i+1][j];
if (a[j]==a[(j+1)%n])
{
if (nex[1][i+1][(j+1)%n]<=i+k)
dp[i][j]=1;
}
else
{
if (nex[0][i+1][(j+1)%n]<=i+k)
dp[i][j]=1;
}
nex[dp[i][j]][i][j]=i;
}
}
for (int i=0;i<n;i++)
printf("%d ",(a[i]^dp[0][i]^1));
}
Compilation message (stderr)
# | 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... |