Submission #475388

# Submission time Handle Problem Language Result Execution time Memory
475388 2021-09-22T09:06:23 Z Ahmed_Solyman Rasvjeta (COCI17_rasvjeta) C++14
50 / 50
2 ms 332 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ll n,m,k;cin>>n>>m>>k;
    map<ll,bool>vis;
    while(m--){
        ll x;cin>>x;
        for(ll i=x-k;i<=x+k;i++)vis[i]=1;
    }
    ll ans=0;
    for(ll i=1;i<=n;i++){
        if(!vis[i]){
            for(ll j=i+k;j>=i;j--)vis[j]=1;
            for(ll j=i+k;j<=i+k*2;j++)vis[j]=1;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct