結果

問題 No.406 鴨等間隔の法則
ユーザー asdfghjkl;asdfghjkl;
提出日時 2020-03-13 22:24:26
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-02 08:26:48
合計ジャッジ時間 1,632 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int cmp(const void *a,const void *b){
    if(*(int*)a>*(int*)b){return 1;}
    else if(*(int*)a<*(int*)b){return -1;}
    else {return 0;}
}


int main(void){
int n,x[100003];
scanf("%d",&n);

for(int i=0;i<n;i++){
    scanf("%d",&x[i]);
}

int dif=abs(x[0]-x[1]);


for(int i=1;i<n;i++){
    if(dif!=abs(x[i-1]-x[i])){printf("NO\n"); return 0;}
}

qsort(x,n,sizeof(int),cmp);

for(int i=1;i<n;i++){
    if(x[i-1]!=x[i]){printf("NO\n");return 0;}
}

printf("YES\n");


}
0