結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2019-09-05 09:21:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 392 bytes |
コンパイル時間 | 1,549 ms |
コンパイル使用メモリ | 171,268 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 12:42:28 |
合計ジャッジ時間 | 3,383 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n,s,flug=0; cin>>n; vector<int> x(n); for(int i=0;i<n;i++)cin>>x[i]; sort(x.begin(),x.end()); s=abs(x[0]-x[1]); if(s!=0){ for(int i=0;i<n-1;i++){ if(abs(x[i]-x[i+1])!=s)flug=1; } }else flug=1; if(flug==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }