結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
|
提出日時 | 2017-12-30 21:26:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 1,737 ms |
コンパイル使用メモリ | 170,964 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 12:17:59 |
合計ジャッジ時間 | 2,847 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) #define FOR(i, m, n) for(int i = m; i < n; i++) #define VSORT(v) sort(v.begin(), v.end()) int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); REP(i, n) cin >> a[i]; VSORT(a); int diff = a[1] - a[0]; if (diff == 0) { cout << "NO" << endl; return 0; } FOR(i, 2, n) { if (a[i] - a[i - 1] != diff) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }