Submission #475365

# Submission time Handle Problem Language Result Execution time Memory
475365 2021-09-22T08:12:53 Z HossamHero7 Rasvjeta (COCI17_rasvjeta) C++14
10 / 50
1 ms 316 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define endl '\n'
void solve(){
    int n,m,k;
    cin>>n>>m>>k;
    vector <bool> vis(n+1);
    for(int i=0;i<m;i++){
        int x;
        cin>>x;
        for(int i=x;i>=max(x-k,1);i--){
            vis[i] = 1;
        }
        for(int i=x;i<=min(x+k,n);i++){
            vis[i] = 1;
        }
    }
    ll ans = 0;
    for(int i=1;i<=n;i++) {
        if(vis[i] == 0) ans ++;
    }
    ans = ceil(ans/(double)(k*2));
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);      cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Incorrect 1 ms 316 KB Output isn't correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Correct 1 ms 308 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Incorrect 1 ms 204 KB Output isn't correct