Submission #199945

# Submission time Handle Problem Language Result Execution time Memory
199945 2020-02-04T10:25:48 Z mohammedehab2002 Vođe (COCI17_vode) C++11
120 / 120
357 ms 291960 KB
#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

vode.cpp: In function 'int main()':
vode.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d",&n,&m,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~
vode.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&a[i]);
  ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1272 KB Output is correct
2 Correct 5 ms 1400 KB Output is correct
3 Correct 5 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 7032 KB Output is correct
2 Correct 6 ms 2680 KB Output is correct
3 Correct 8 ms 6136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4344 KB Output is correct
2 Correct 7 ms 4216 KB Output is correct
3 Correct 8 ms 4344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 6136 KB Output is correct
2 Correct 9 ms 6392 KB Output is correct
3 Correct 9 ms 6264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 8568 KB Output is correct
2 Correct 10 ms 7800 KB Output is correct
3 Correct 9 ms 6904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 8312 KB Output is correct
2 Correct 10 ms 8440 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 55160 KB Output is correct
2 Correct 60 ms 61680 KB Output is correct
3 Correct 357 ms 267768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 111 ms 118648 KB Output is correct
2 Correct 265 ms 239864 KB Output is correct
3 Correct 115 ms 121720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 341 ms 291960 KB Output is correct
2 Correct 35 ms 63608 KB Output is correct
3 Correct 33 ms 62456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 316 ms 287740 KB Output is correct
2 Correct 292 ms 255864 KB Output is correct
3 Correct 348 ms 283984 KB Output is correct