# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
83346 | charlies_moo | Rasvjeta (COCI17_rasvjeta) | C++17 | 2 ms | 532 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 <cstdio>
#include <cstring>
int main() {
int n, m, k;
scanf("%d", &n);
scanf("%d", &m);
scanf("%d", &k);
bool s[n];
memset(s, 0, sizeof(s));
for (int i = 0; i < m; i++) {
int a;
scanf("%d", &a);
a--;
int l = a - k;
if (l < 0) {
l = 0;
}
int r = a + k;
if (r >= n) {
r = n - 1;
}
for (int j = l; j <= r; j++) {
s[j] = 1;
}
}
int ans = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 0) {
ans++;
int l = i;
int r = i + 2 * k;
if (r >= n) {
r = n - 1;
}
for (int j = l; j <= r; j++) {
s[j] = 1;
}
}
}
printf("%d\n", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |