結果

問題 No.406 鴨等間隔の法則
ユーザー traindoggotraindoggo
提出日時 2024-02-05 18:51:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 1,004 bytes
コンパイル時間 2,438 ms
コンパイル使用メモリ 206,268 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-05 18:51:12
合計ジャッジ時間 4,614 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG_
#include <compe/debug.hpp>
#else
#define dump(...)
#endif

#define FastIO cin.tie(nullptr), ios_base::sync_with_stdio(false);
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define output(msg) cout << (msg) << '\n'
#define die(msg)         \
  do {                   \
    cout << msg << endl; \
    exit(0);             \
  } while (0)
#define all(k) k.begin(), k.end()
#define INFi 1 << 30
#define INFll 1LL << 60

template <typename T> bool chmax(T& a, const T& b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> bool chmin(T& a, const T& b) {
  return ((a > b) ? (a = b, true) : false);
}

using llint = long long int;

int main() {
  FastIO;
  int n;
  cin >> n;

  vector<int> kamo(n);
  rep(i, n) cin >> kamo[i];
  sort(all(kamo));

  int diff = abs(kamo[0] - kamo[1]);
  rep(i, n - 1) {
    int d = abs(kamo[i] - kamo[i + 1]);
    if (diff != d || d == 0) {
      die("NO");
    }
  }

  output("YES");
}
0