結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2016-08-06 07:04:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 1,660 bytes |
コンパイル時間 | 773 ms |
コンパイル使用メモリ | 101,108 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 11:29:32 |
合計ジャッジ時間 | 2,044 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <queue> #include <climits> using namespace std; using ull = unsigned long long; using ll = long long; using lli = long long int; using ld = long double; using pa = pair<int,int>; using ppa = pair<pa,int>; #define SORT(v, n) sort(v, v+n); #define ALL(v) v.begin(),v.end() #define VSORT(v) sort(ALL(v)) #define GRESORT(v) sort(ALL(v),greater<ll>()) #define REVERSE(v) reverse(ALL(v)) #define overlap(v) v.erase(unique(ALL(v)),v.end()) #define debug(x) cout << #x << ": " << x << endl #define FOR(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,n) FOR(i,0,n) #define RFOR(i,a,b) for(int i = (b-1); i >= a; i--) #define rrep(i,n) RFOR(i,0,n) #define INF INT_MAX #define mins(a,b) a = min(a,b) #define maxs(a,b) a = max(a,b) //4近傍 //int dy[]={0, 1, 0, -1}; //int dx[]={1, 0, -1, 0}; //8近傍 int dy[]={0,0,1,-1,1,1,-1,-1}; int dx[]={1,-1,0,0,1,-1,1,-1}; ll MOD = 1000000007; void solve() { int n; cin >> n; vector<ll> x(n); rep(i,n) cin >> x[i]; VSORT(x); ll tmp = x[1] - x[0]; FOR(i,2,n){ if(tmp == 0 || x[i] - x[i-1] != tmp){ cout << "NO" << endl; return; } } cout << "YES" << endl; } int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); solve(); return 0; }