結果
| 問題 |
No.406 鴨等間隔の法則
|
| ユーザー |
algon_320
|
| 提出日時 | 2016-08-05 22:37:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 1,109 bytes |
| コンパイル時間 | 1,190 ms |
| コンパイル使用メモリ | 168,820 KB |
| 実行使用メモリ | 8,320 KB |
| 最終ジャッジ日時 | 2024-07-07 11:22:28 |
| 合計ジャッジ時間 | 3,186 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;
template<class T,class U>ostream&operator<<(ostream &os,const pair<T,U> &p){
os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T>ostream&operator<<(ostream &os,const vector<T> &v){
ITR(i,v)os<<*i<<(i==end(v)-1?"":" ");return os;}
//-----------------------------------------------------------
int main(int argc, char const *argv[]) {
int N;
cin>>N;
vector<int> x(N);
set<int> s;
REP(i,N) {
cin>>x[i];
s.insert(x[i]);
}
sort(ALL(x));
if((int)s.size()!=N) {
cout<<"NO"<<endl;
return 0;
}
int d=x[1]-x[0];
FOR(i,1,N) {
if(x[i-1]+d!=x[i]) {
cout<<"NO"<<endl;
return 0;
}
}
cout<<"YES"<<endl;
return 0;
}
algon_320