結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2017-02-28 19:11:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 43 ms / 2,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 593 ms |
コンパイル使用メモリ | 75,708 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 11:59:38 |
合計ジャッジ時間 | 2,690 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for(int i=0; i<n; ++i) { cin >> v[i]; } sort(v.begin(), v.end()); bool ok = true; int d = v[1]-v[0]; for(int i=0; i<n-1; ++i) { ok &= d == v[i+1]-v[i] && v[i] != v[i+1]; } if(ok) { cout << "YES" << endl; } else { cout << "NO" << endl; } }