結果

問題 No.406 鴨等間隔の法則
ユーザー 1white_princess1white_princess
提出日時 2022-02-12 13:29:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 1,665 ms
コンパイル使用メモリ 173,992 KB
実行使用メモリ 8,732 KB
最終ジャッジ日時 2023-09-11 00:45:22
合計ジャッジ時間 4,731 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
5,240 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 65 ms
8,080 KB
testcase_05 AC 22 ms
5,144 KB
testcase_06 AC 23 ms
5,008 KB
testcase_07 AC 23 ms
5,116 KB
testcase_08 AC 64 ms
7,780 KB
testcase_09 AC 71 ms
8,732 KB
testcase_10 AC 26 ms
5,296 KB
testcase_11 AC 54 ms
7,232 KB
testcase_12 AC 33 ms
5,768 KB
testcase_13 AC 31 ms
5,676 KB
testcase_14 AC 64 ms
7,516 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 6 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 5 ms
4,376 KB
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 9 ms
4,376 KB
testcase_21 AC 9 ms
4,376 KB
testcase_22 AC 16 ms
4,444 KB
testcase_23 AC 36 ms
5,884 KB
testcase_24 AC 58 ms
6,972 KB
testcase_25 AC 74 ms
8,664 KB
testcase_26 AC 84 ms
8,580 KB
testcase_27 AC 37 ms
4,376 KB
testcase_28 AC 63 ms
8,600 KB
testcase_29 AC 86 ms
8,604 KB
testcase_30 AC 80 ms
8,308 KB
testcase_31 AC 67 ms
8,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(LL i = a;i<b; i++)
#define rrep(i,a,b) for(LL i = a;i>b; i--)
#define INF ((1LL<<62)-(1LL<<31))
#define ooki 9,223,372,036,854,775,807
#define tii -9,223,372,036,854,775,808
typedef long long LL;
int main(){
 LL n;
  cin >> n;
  set<LL> s;
  vector<LL> x(n);
  rep(i,0,n){cin>>x[i];s.insert(x[i]);}
  if(s.size()!=n){cout<<"NO"<<endl;return 0;}
  sort(x.begin(),x.end());
  LL a = x[1]-x[0];
  rep(i,0,n-1){
    if(x[i+1]-x[i]!=a){cout<<"NO"<<endl;return 0;}
  }
  cout << "YES" << endl;
}
  

    
  
    
     
   
   
    
    
    
 
    



    


0