Submission #86416

# Submission time Handle Problem Language Result Execution time Memory
86416 2018-11-26T09:36:13 Z MaHaMBa_25 Telefoni (COCI17_telefoni) C++14
40 / 80
6 ms 620 KB
#include <bits/stdc++.h>
#define GLHF ios_base::sync_with_stdio(0); cin.tie(), cout.tie();
#define GGWP return 0;
#define ALTF4 exit(0)
#define GCWS/*Good Contest, Well Solved*/ ALTF4
#define ull unsigned long long
#define ll long long
#define ld long double
#define fxr1(x) for(int I = 0; I < x; ++I)
#define fxr(x) for(int I = 0; I <= x; ++I)
 
using namespace std;
 
int n, d, ans, cnt;
bool a[21];
 
int main()
{
	GLHF
	cin >> n >> d;
	for ( int I = 0; I < n; ++I )	
	{
		cin >> a[I];
		if ( a[I] == 0 )
			++cnt;
		else
			cnt = 0;
		if ( cnt == d )
		{
			++ans;
			a[I] = 1;
			cnt -= d;
		}
	}
	if ( d <= 2 && a[n - 1] == 0 && a[0] == 0 )
		++ans;
	cout << ans << endl;
	GGWP
}
 
//clang++ -v -std=c++11 finish fishing the fish.people
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Incorrect 2 ms 520 KB Output isn't correct
7 Incorrect 2 ms 544 KB Output isn't correct
8 Incorrect 6 ms 548 KB Output isn't correct
9 Incorrect 2 ms 564 KB Output isn't correct
10 Incorrect 2 ms 620 KB Output isn't correct