結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2017-09-24 19:51:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 575 bytes |
コンパイル時間 | 773 ms |
コンパイル使用メモリ | 79,160 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 12:10:59 |
合計ジャッジ時間 | 1,958 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <iostream> #include <iomanip> #include <cmath> #include <algorithm> typedef long long ll; int main(void) { std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(13); int n; std::cin >> n; ll x[n]; for (int i = 0; i < n; ++i) std::cin >> x[i]; std::sort(x, x+n); ll diff = x[1] - x[0]; if (diff==0) {std::cout << "NO" << std::endl; return 0;} for (int i = 2; i < n; ++i) { if (x[i] - x[i-1] != diff) {std::cout << "NO" << std::endl; return 0;} } std::cout << "YES" << std::endl; return 0; }