結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2016-09-12 18:00:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 743 bytes |
コンパイル時間 | 1,059 ms |
コンパイル使用メモリ | 77,872 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-11-07 05:59:52 |
合計ジャッジ時間 | 5,281 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 TLE * 1 -- * 17 |
ソースコード
# include <iostream> # include <cstring> # include <string> # include <vector> # include <cmath> # include <sstream> # include <iomanip> # include <algorithm> using namespace std; # define repl(i, a, b) for(int i=(int)(a);i<(int)(b);i++) # define rep(i, n) repl(i, 0, n) typedef long long ll; int main(){ cin.sync_with_stdio(false); int n; cin >> n; vector<ll> v(n); rep(i, n){ cin >> v[i]; } sort(v.begin(), v.end()); int r = abs(v[1] - v[0]); repl(i, 1, n-1){ if(r != abs(v[i] - v[i+1])){ //cout << r << endl; //cout << v[i+1] - v[i] << endl; cout << "NO" << endl; return 0; } repl(j, i ,n){ if(i!=j && v[i] == v[j]){ cout << "NO" << endl; return 0; } } } cout << "YES" << endl; return 0; }