Submission #83370

# Submission time Handle Problem Language Result Execution time Memory
83370 2018-11-07T11:24:14 Z charlies_moo Rasvjeta (COCI17_rasvjeta) C++
10 / 50
3 ms 532 KB
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
const int MAXN=1002;
typedef long long l;
typedef bool b;
using namespace std;
l n,m,k;
l lamp[MAXN];
l size_max;
l size_low;
//l siz=0;
l cnt=0;
b flag=false;
int main(void)
{
    ios::sync_with_stdio(false);
    memset(lamp,-1,sizeof(lamp));
    cin >> n >> m >> k;
    for(l i=0;i<m;i++) cin >> lamp[i];
    //cout << lamp[0] << endl;
    //cout << lamp[j] << endl;
    size_max=lamp[m-1]+k;
    //cout << lamp[j]+k << endl;
    size_low=lamp[0]-k;
    //cout << lamp[j]-k << endl;
    if(size_low<=0) size_low=0;
    /*for(int i=0;i<MAXN;i++)
    {
        if(size[i]!=0) siz++;
        else break;
    }*/
    //cout << size_max << endl;
    //cout << size_low << endl;
    if(size_max<n)
    {
        //cout << (n-size_max)/(2*k+1) << endl;
        if((n-size_max)/(2*k+1)>1) cnt+=(n-size_max)/(2*k+1);
        else if((n-size_max)/(2*k+1)>=0&&(n-size_max)/(2*k+1)<1) cnt+=1;
        flag=true;
    }
    if(size_low>0)
    {
        cnt+=(size_low)/(2*k+1);
        flag=true;
    }
    //unique(_ForwardIterator __first,_ForwardIterator __last,_BinaryPredicate __pred);
    if(flag==true) cout << cnt << endl;
    else if(flag==false) cout << "0" << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 512 KB Output isn't correct
3 Incorrect 2 ms 512 KB Output isn't correct
4 Incorrect 2 ms 512 KB Output isn't correct
5 Incorrect 2 ms 512 KB Output isn't correct
6 Incorrect 2 ms 512 KB Output isn't correct
7 Incorrect 2 ms 532 KB Output isn't correct
8 Correct 2 ms 532 KB Output is correct
9 Correct 2 ms 532 KB Output is correct
10 Incorrect 3 ms 532 KB Output isn't correct