답안 #475367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
475367 2021-09-22T08:25:43 Z Ahmed57 Rasvjeta (COCI17_rasvjeta) C++14
10 / 50
1 ms 204 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    int arr[m+2];arr[0] = 1-k;
    for(int i = 1;i<=m;i++){
        cin>>arr[i];
    }arr[m+1] = n;
    sort(arr,arr+m);
    int sum = 0;int z = ((k*2)+1);
    for(int i = 1;i<=m;i++){
        int u = arr[i]-k;
        int r = arr[i-1]+k;
        if(((u-r))>0){
            int o = ((u-r))/z;
            if(((u-r))%z!=0)o++;
            sum+=max(o,0);
        }
    }
    int u = n;
    int r = arr[m]+k;
    if(((u-r))>0){
        int o = ((u-r))/z;
        if(((u-r))%z!=0)o++;
        sum+=max(o,0);
    }
    cout<<sum<<"\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Incorrect 0 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 204 KB Output isn't correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Incorrect 1 ms 204 KB Output isn't correct