Submission #98098

# Submission time Handle Problem Language Result Execution time Memory
98098 2019-02-20T16:47:59 Z dalgerok Rasvjeta (COCI17_rasvjeta) C++17
40 / 50
4 ms 384 KB
#include<bits/stdc++.h>
using namespace std;




int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    int a[n + 1];
    memset(a, 0, sizeof(a));
    for(int i = 1; i <= m; i++){
        int x;
        cin >> x;
        a[max(0, x - k)] += 1;
        a[min(n, x + k + 1)] -= 1;
    }
    int cur = 0, ans = 0;
    for(int i = 0; i < n; i++){
        cur += a[i];
        if(cur == 0){
            ans += 1;
            cur += 1;
            a[min(n, i + 2 * k + 1)] -= 1;
        }
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Incorrect 2 ms 384 KB Output isn't correct