답안 #165617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
165617 2019-11-27T19:27:02 Z itiam Rasvjeta (COCI17_rasvjeta) C++11
30 / 50
2 ms 404 KB
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>

using namespace std;

int L[1003];
int main(){
    int N,M,K,P,z,z2,br=0;
    cin >> N >> M >> K;
    //K+=1;
    for (int i=0;i<M;i++){
        cin >> P;
        P-=1;
        z=P-K;
        z2=P+K+1;
        if (z<0)    z=0;
        if (z2>N)   z2=N;
        for (int j=z;j<z2;j++){
            L[j]=1;
        }
    }
    //for(int i=0; i<N;i++)    cout << L[i] << " ";
    //cout << "\n";
    for (int i=0;i<N;i++){
        if (L[i]==0){
            P=i+K;
            z=P-K;
            z2=P+K;
            if (z<0)    z=0;
            if (z2>N)   z2=N;
            for (int j=z;j<z2;j++){
                L[j]=1;
            }
            br+=1;
        }
    }
    //for(int i=0; i<N;i++)    cout << L[i] << " ";
    //cout << "\n";
    cout << br;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 404 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct