結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
|
提出日時 | 2020-11-02 22:57:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 529 bytes |
コンパイル時間 | 1,471 ms |
コンパイル使用メモリ | 171,960 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-22 08:15:39 |
合計ジャッジ時間 | 3,991 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 8 WA * 21 |
ソースコード
#include<bits/stdc++.h> #define rep(i, x) for(ll i = 0; i < x; i++) #define rep2(i, x) for(ll i = 1; i <= x; i++) #define all(a) (a).begin(),(a).end() using ll = long long; using ld = long double; const ll INF = 10000000000000000; using namespace std; signed main() { ll n, cnt = 0; cin >> n; vector<ll> v(n); rep(i, n) { cin >> v[i]; } sort(all(v)); rep(i, n) { if (i == 0) { continue; } else if (i == 1) { cnt = v[i] - v[i - 1]; } else if (v[i] - v[i - 1] != cnt) { cout << "NO\n"; } } cout << "YES\n"; return 0; }