結果

問題 No.406 鴨等間隔の法則
ユーザー toto6114toto6114
提出日時 2020-04-06 16:29:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 1,022 bytes
コンパイル時間 1,074 ms
コンパイル使用メモリ 111,972 KB
実行使用メモリ 8,680 KB
最終ジャッジ日時 2023-09-21 19:32:07
合計ジャッジ時間 3,498 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
5,780 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 57 ms
8,140 KB
testcase_05 AC 18 ms
5,344 KB
testcase_06 AC 19 ms
5,432 KB
testcase_07 AC 19 ms
5,592 KB
testcase_08 AC 56 ms
8,156 KB
testcase_09 AC 67 ms
8,468 KB
testcase_10 AC 22 ms
5,848 KB
testcase_11 AC 48 ms
7,400 KB
testcase_12 AC 28 ms
6,100 KB
testcase_13 AC 26 ms
5,896 KB
testcase_14 AC 52 ms
7,644 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 4 ms
4,376 KB
testcase_19 AC 5 ms
4,380 KB
testcase_20 AC 7 ms
4,380 KB
testcase_21 AC 7 ms
4,544 KB
testcase_22 AC 12 ms
4,752 KB
testcase_23 AC 30 ms
6,260 KB
testcase_24 AC 44 ms
7,140 KB
testcase_25 AC 65 ms
8,428 KB
testcase_26 AC 65 ms
8,572 KB
testcase_27 AC 14 ms
4,380 KB
testcase_28 AC 36 ms
8,624 KB
testcase_29 AC 64 ms
8,680 KB
testcase_30 AC 62 ms
8,332 KB
testcase_31 AC 62 ms
8,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,x[100005]={},dist;
  map<int,int> m;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> x[i];
    m[x[i]]++;
  }
  sort(x,x+n);
  if(m[x[0]]==n) {
    cout << "NO" << endl;
    return 0;
  }
  dist=x[1]-x[0];
  for(int i=1; i<n-1; i++) {
    if(x[i+1]-x[i]!=dist) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
0