結果

問題 No.406 鴨等間隔の法則
ユーザー Daylight
提出日時 2018-05-13 16:36:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,126 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 91,988 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-07 12:27:43
合計ジャッジ時間 28,991 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <complex>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <typeinfo>
#include <cassert>
#include <fstream>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i = a;i<b;i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;

int main (){
  int n;
  vector<long int> x;
  while (cin >> n){
    bool b = false;
    REP(i,n){
      long int a;
      cin >> a;
      if(find(ALL(x),a) != x.end()){
	b = true;
      }
      x.push_back(a);
    }
    if(b){
      cout << "NO" << endl;
      continue;
    }
    sort(ALL(x));
    long int d = x[1] - x[0];
    FOR(i,2,n){
      if(x[i] - x[i-1] != d ){
	cout << "NO" << endl;
	b = true;
	break;
      }
    }

    if(!b) cout << "YES" << endl;
  }
  return 0;
}
0