답안 #86371

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86371 2018-11-26T08:20:32 Z MaHaMBa_25 Telefoni (COCI17_telefoni) C++17
24 / 80
3 ms 868 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, st, cnt;
bool a[21];
 
int main()
{
	GLHF
	cin >> n >> d;
	for ( int I = 0; I < n; ++I )	
		cin >> a[I];
	for ( int I = 0; I < d; ++I )
		if ( a[I] == 1 )
		{
			st = I;
			break;
		}
	for ( int I = st; I < n; ++I )
	{
		int cnt = 1;
		for ( int J = d; J > 0; --J )
		{
			if ( a[J + I] == 1 )
				I = J + I;
			else if ( J < 2 )
			{
				++ans;
				I = I + d;
			}
		}
	}
	for ( int I = 0; I < d; ++I )
	{
		if ( a[I] == 0 )
			++cnt;
	}
	if ( a[n - 1] == 0 )
		++cnt;
	ans += cnt/d;
	cout << ans << endl;
	GGWP
}
 
//clang++ -v -std=c++11 finish fishing the fish.people

Compilation message

telefoni.cpp: In function 'int main()':
telefoni.cpp:31:7: warning: unused variable 'cnt' [-Wunused-variable]
   int cnt = 1;
       ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 472 KB Output isn't correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 2 ms 476 KB Output is correct
6 Runtime error 3 ms 600 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 3 ms 732 KB Execution killed with signal 8 (could be triggered by violating memory limits)
8 Runtime error 3 ms 756 KB Execution killed with signal 8 (could be triggered by violating memory limits)
9 Runtime error 3 ms 756 KB Execution killed with signal 8 (could be triggered by violating memory limits)
10 Runtime error 3 ms 868 KB Execution killed with signal 8 (could be triggered by violating memory limits)