Submission #85833

# Submission time Handle Problem Language Result Execution time Memory
85833 2018-11-21T21:21:05 Z kraljlavova1 Rasvjeta (COCI17_rasvjeta) C++11
50 / 50
3 ms 640 KB
#include<bits/stdc++.h>
using namespace std;
const int MAX=1010;
int n,m,k,x,s,sol;
int r[MAX];
int main(){
	cin>>n>>m>>k;
	for(int i=0;i<m;i++){
		cin>>x;x--;
		r[max(0,x-k)]++;
		r[min(n,x+k+1)]--;
	}
	for(int i=0;i<n;i++){
		s+=r[i];
		if(!s){
			sol++;
			s++;
			r[i+2*k+1]--;
		}
	}
	cout<<sol;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 424 KB Output is correct
5 Correct 2 ms 424 KB Output is correct
6 Correct 2 ms 424 KB Output is correct
7 Correct 2 ms 436 KB Output is correct
8 Correct 2 ms 528 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct