結果

問題 No.406 鴨等間隔の法則
ユーザー DaylightDaylight
提出日時 2018-05-13 16:36:45
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,126 bytes
コンパイル時間 676 ms
コンパイル使用メモリ 92,244 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-21 18:51:52
合計ジャッジ時間 31,065 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 401 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1,966 ms
4,380 KB
testcase_05 AC 276 ms
4,376 KB
testcase_06 AC 309 ms
4,376 KB
testcase_07 AC 323 ms
4,376 KB
testcase_08 AC 1,925 ms
4,376 KB
testcase_09 TLE -
testcase_10 AC 398 ms
4,376 KB
testcase_11 AC 1,439 ms
4,376 KB
testcase_12 AC 611 ms
4,376 KB
testcase_13 AC 528 ms
4,380 KB
testcase_14 AC 1,649 ms
4,376 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 15 ms
4,376 KB
testcase_17 AC 5 ms
4,380 KB
testcase_18 AC 18 ms
4,376 KB
testcase_19 AC 22 ms
4,376 KB
testcase_20 AC 40 ms
4,380 KB
testcase_21 AC 42 ms
4,380 KB
testcase_22 AC 124 ms
4,380 KB
testcase_23 AC 691 ms
4,376 KB
testcase_24 AC 1,275 ms
4,376 KB
testcase_25 TLE -
testcase_26 TLE -
testcase_27 AC 36 ms
4,376 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
権限があれば一括ダウンロードができます

ソースコード

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