답안 #145497

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
145497 2019-08-20T09:13:14 Z charlies_moo Rasvjeta (COCI17_rasvjeta) C++
50 / 50
3 ms 376 KB
#include <iostream>
using namespace std;
int main()
{
	int n, k, l, x, i, j, s;
	cin >> n >> k >> l;
	int a[n+1]={0};
	for(i=0;i<k;i++)
	{
		cin >> x;
		for(j=-l;j<=l;j++)
		{
			if(x+j>=1 && x+j<=n)
			    a[x+j]=1;
		}
	}
	s=0;
	for(i=1;i<=n;i++)
	{
		if(a[i]==0)
		{
			for(j=0;j<=2*l;j++)
			{
				if(i+j<=n)
				    a[i+j]=1;
			}
			s++;
		}
	}
	cout << s;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct