답안 #12816

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
12816 2015-01-04T23:55:24 Z Namnamseo 격자 보존하기 (GA9_preserve) C++
0 / 100
28 ms 1868 KB
#include <cstdio>
#include <algorithm>

using namespace std;

int n, k, d;
int data[100010];
int cnv_data[100010];

int main()
{
    scanf("%d%d%d",&n,&k,&d);
    int i;
    for(i=0;i<k;++i) scanf("%d",data+i);
    sort(data,data+k);
    int ind=0;
    cnv_data[0]=data[0]-1;
    for(i=1;i<k;++i){
        cnv_data[i]=data[i]-data[i-1]-1;
    }
    cnv_data[k]=n-data[k-1];
    sort(cnv_data+1,cnv_data+k);
    int ans=0;
    if(d&1){
        for(i=k-1;i>=(k-d/2) && i>=1;--i){
            ans+=cnv_data[i];
        }
        ans+=max(cnv_data[0],cnv_data[k]);
    } else {
        for(i=k-1;i>(k-d/2) && i>=1;--i){
            ans+=cnv_data[i];
        }
        ans+=max(cnv_data[0],max(cnv_data[k],cnv_data[k-d/2]));
    }
    printf("%d\n",ans);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1868 KB Output is correct
2 Correct 0 ms 1868 KB Output is correct
3 Correct 0 ms 1868 KB Output is correct
4 Correct 0 ms 1868 KB Output is correct
5 Correct 0 ms 1868 KB Output is correct
6 Correct 0 ms 1868 KB Output is correct
7 Correct 0 ms 1868 KB Output is correct
8 Incorrect 0 ms 1868 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1868 KB Output is correct
2 Correct 0 ms 1868 KB Output is correct
3 Correct 0 ms 1868 KB Output is correct
4 Correct 0 ms 1868 KB Output is correct
5 Correct 0 ms 1868 KB Output is correct
6 Correct 0 ms 1868 KB Output is correct
7 Correct 0 ms 1868 KB Output is correct
8 Correct 0 ms 1868 KB Output is correct
9 Correct 0 ms 1868 KB Output is correct
10 Correct 0 ms 1868 KB Output is correct
11 Correct 0 ms 1868 KB Output is correct
12 Correct 0 ms 1868 KB Output is correct
13 Correct 0 ms 1868 KB Output is correct
14 Correct 0 ms 1868 KB Output is correct
15 Correct 0 ms 1868 KB Output is correct
16 Correct 0 ms 1868 KB Output is correct
17 Correct 0 ms 1868 KB Output is correct
18 Correct 0 ms 1868 KB Output is correct
19 Incorrect 0 ms 1868 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1868 KB Output is correct
2 Correct 0 ms 1868 KB Output is correct
3 Correct 0 ms 1868 KB Output is correct
4 Correct 0 ms 1868 KB Output is correct
5 Correct 0 ms 1868 KB Output is correct
6 Correct 0 ms 1868 KB Output is correct
7 Correct 0 ms 1868 KB Output is correct
8 Incorrect 0 ms 1868 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 1868 KB Output is correct
2 Correct 20 ms 1868 KB Output is correct
3 Correct 20 ms 1868 KB Output is correct
4 Correct 28 ms 1868 KB Output is correct
5 Correct 28 ms 1868 KB Output is correct
6 Correct 24 ms 1868 KB Output is correct
7 Correct 28 ms 1868 KB Output is correct
8 Correct 28 ms 1868 KB Output is correct
9 Incorrect 16 ms 1868 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 1868 KB Output isn't correct
2 Halted 0 ms 0 KB -