結果

問題 No.406 鴨等間隔の法則
ユーザー ElkElk
提出日時 2018-06-03 20:40:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 31,812 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 21:58:17
合計ジャッジ時間 2,467 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 25 ms
4,380 KB
testcase_05 AC 10 ms
4,376 KB
testcase_06 AC 10 ms
4,376 KB
testcase_07 AC 10 ms
4,376 KB
testcase_08 AC 24 ms
4,376 KB
testcase_09 AC 26 ms
4,376 KB
testcase_10 AC 11 ms
4,376 KB
testcase_11 AC 21 ms
4,380 KB
testcase_12 AC 14 ms
4,380 KB
testcase_13 AC 13 ms
4,376 KB
testcase_14 AC 23 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 5 ms
4,380 KB
testcase_21 WA -
testcase_22 AC 7 ms
4,380 KB
testcase_23 AC 15 ms
4,376 KB
testcase_24 AC 20 ms
4,380 KB
testcase_25 AC 27 ms
4,380 KB
testcase_26 AC 27 ms
4,380 KB
testcase_27 AC 17 ms
4,376 KB
testcase_28 AC 18 ms
4,380 KB
testcase_29 AC 27 ms
4,376 KB
testcase_30 AC 27 ms
4,376 KB
testcase_31 AC 26 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int func(const void *a, const void *b){
    return *(int *)a - *(int *)b;
}

int main(){
    int N, i, sub, cnt = 0;
    int kamo[100000];

    scanf("%d\n", &N);
    for(i = 0; i < N; i++){
        scanf("%d ", &kamo[i]);
    }
    qsort(kamo, N, sizeof(int), func);

    for(i = 1; i < N; i++){
        sub = kamo[i] - kamo[i - 1];
        //printf("%d\n", sub);
        if(sub == (kamo[i] - kamo[i - 1]) && sub != 0){
            cnt++;
        }else{
            printf("NO\n");
            break;
        }
    }
    if(cnt == N - 1){
        printf("YES\n");
    }

    return 0;
}
0