結果

問題 No.406 鴨等間隔の法則
ユーザー sk3388607083sk3388607083
提出日時 2018-06-24 11:24:46
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 596 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 27,508 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2023-09-13 13:32:52
合計ジャッジ時間 10,754 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

void sort(int *a, int size){
  int i, j, tmp;
  for(i = 0 ; i < size-1; i++){
    for(j = size-1; j > i; j--){
      if(a[j-1] > a[j]){
	tmp = a[j-1];
	a[j-1] = a[j];
	a[j] = tmp;
      }
    }
  }
}

int main(void){
  int i;
  int N, S[100000];
  int l, flag = 0;
  scanf("%d", &N);
  for(i = 0; i < N; i++){
    scanf("%d", &S[i]);
  }
  sort(S, N);
  l = abs(S[1] - S[0]);
  for(i = 1; i < N - 1; i++){
    if(l != abs(S[i+1] - S[i])){
      flag = 1;
      break;
    }
  }
  if(l != 0 && flag == 0) printf("YES\n");
  else printf("NO\n");
  return 0;
}
0