Submission #199957

# Submission time Handle Problem Language Result Execution time Memory
199957 2020-02-04T11:37:46 Z zoooma13 Vođe (COCI17_vode) C++14
72 / 120
3000 ms 23928 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n ,M ,k;
	scanf("%d%d%d",&n,&M,&k);
	vector <int> a(n);
	for(int&i : a)
		scanf("%d",&i);
		
	auto nxt = [&](int i){
		return i == n-1 ? 0 : i+1;
	};
	
	bool dp[M+1][n+1] = {0};
	for(int m=M-1; m>0; m--){
		for(int i=0; i<n; i++)
		for(int j=m+1; j<=min(M ,m+k); j++)
			dp[m][i] |= (dp[j][nxt(i)]^a[i]^a[nxt(i)]);
	}
	
	for(int i=0; i<n; i++){
		printf("%d ",dp[1][i]^a[i]^1);
	}
	printf("\n");
}

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:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&i);
   ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 5 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 17 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 17 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 376 KB Output is correct
2 Correct 27 ms 376 KB Output is correct
3 Correct 8 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 504 KB Output is correct
2 Correct 16 ms 504 KB Output is correct
3 Correct 60 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 25 ms 504 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 134 ms 3320 KB Output is correct
2 Correct 1219 ms 3680 KB Output is correct
3 Execution timed out 3077 ms 21752 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1672 ms 7416 KB Output is correct
2 Execution timed out 3075 ms 19448 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3094 ms 23928 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3076 ms 23672 KB Time limit exceeded
2 Halted 0 ms 0 KB -