Submission #475396

# Submission time Handle Problem Language Result Execution time Memory
475396 2021-09-22T09:15:20 Z Mr_Ph Rasvjeta (COCI17_rasvjeta) C++14
10 / 50
363 ms 65540 KB
///made by : Mr_Ph :D
#include<bits/stdc++.h>
#include<unordered_map>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
const double PI=acos(-1.0);
const ll mod=(ll)1e9+7;
//int dx[4] = {0, 0, 1, -1};
//int dy[4] = {1, -1, 0, 0};
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
///the end of the defines ;)
void solve()
{
    int n,m,k;
    cin>>n>>m>>k;
    map<int,int>mp;
    while(m--)
    {
        int x;
        cin>>x;
        for(int i=max(1,x-k);i<=x+k;i++)mp[i]++;
    }
    ll cnt=0;
    for(int i=1;i<=n;i++)
    {
        if(!mp[i])
        {
            for(int i=max(1,i-k);i<=i+k;i++)
                mp[i]++;
            cnt++;
        }
    }
    cout<<cnt<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("window.in","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;//int st;
    //cin>>t;//cin>>st;
    while(t--)
        solve();
}
# Verdict Execution time Memory Grader output
1 Runtime error 329 ms 65540 KB Execution killed with signal 9
2 Runtime error 345 ms 65540 KB Execution killed with signal 9
3 Runtime error 329 ms 65540 KB Execution killed with signal 9
4 Runtime error 325 ms 65540 KB Execution killed with signal 9
5 Runtime error 363 ms 65540 KB Execution killed with signal 9
6 Runtime error 325 ms 65540 KB Execution killed with signal 9
7 Runtime error 330 ms 65540 KB Execution killed with signal 9
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Runtime error 324 ms 65540 KB Execution killed with signal 9