結果

問題 No.406 鴨等間隔の法則
ユーザー saltcandy123
提出日時 2016-08-05 22:33:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 62,084 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 11:19:39
合計ジャッジ時間 1,981 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

int main() {
  int n;
  int x[100000];
  std::cin >> n;
  for (int ni = 0; ni < n; ++ni) {
    std::cin >> x[ni];
  }
  std::sort(x, x + n);
  for (int ni = 0; ni < n - 1; ++ni) {
    if (x[1] - x[0] == 0 or x[1] - x[0] != x[ni + 1] - x[ni]) {
      std::cout << "NO" << std::endl;
      return 0;
    }
  }
  std::cout << "YES" << std::endl;
  return 0;
}
0