結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2018-09-04 18:32:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 484 bytes |
コンパイル時間 | 1,885 ms |
コンパイル使用メモリ | 162,664 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 12:29:57 |
合計ジャッジ時間 | 3,336 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include<bits/stdc++.h> #define REP(i,n) for(int i=0;i<(int)(n);i++) using namespace std; typedef long long int ll; int main() { int N,s; cin >> N; vector<int> x(N); REP(i,N)cin >> x[i]; sort(x.begin(),x.end()); x.erase(unique(x.begin(),x.end()),x.end()); if(x.size() != N){ cout << "NO" << endl; return 0; } s = x[1]-x[0]; REP(i,N-1){ if(x[i+1]-x[i] != s){ cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }