| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 40399 | szawinis | Rasvjeta (COCI17_rasvjeta) | C++14 | 2 ms | 756 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n, m, k, ans;
bool mark[1001];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> k;
	for(int i = 0, x; i < m; i++) {
		cin >> x;
		for(int j = max(x-k, 1); j <= min(x+k, n); j++) mark[j] = true;
	}
	int last = 0;
	mark[0] = true;
	for(int i = 1; i <= n; i++) {
		if(!mark[i] && mark[i-1]) last = i;
		else if(mark[i] && !mark[i-1]) ans += (i-last+2*k) / (2*k+1);
	}
	if(!mark[n]) ans += (n+1-last+2*k) / (2*k+1);
	cout << ans;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
