結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2022-07-25 17:07:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 495 bytes |
コンパイル時間 | 1,522 ms |
コンパイル使用メモリ | 172,480 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 18:21:48 |
合計ジャッジ時間 | 4,300 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; #define rep(i,p,n)for(ll i=(ll)p;i<(ll)n;i++) #define all(x)(x).begin(),(x).end() #define edt(x1,y1,x2,y2)sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) int main(){ ll N; cin>>N; vector<ll> X(N); rep(i,0,N){ cin>>X[i]; } sort(all(X)); ll diff=X[1]-X[0]; rep(i,0,N-1){ if(X[i+1]==X[i]){ cout<<"NO"<<endl; return 0; } else if(X[i+1]-X[i]!=diff){ cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl; return 0; }