結果
| 問題 | No.406 鴨等間隔の法則 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-08 12:17:13 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 536 bytes |
| 記録 | |
| コンパイル時間 | 1,643 ms |
| コンパイル使用メモリ | 186,448 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-05-26 00:56:38 |
| 合計ジャッジ時間 | 2,964 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin>>N;
vector<long long> birds(N);
for(int i=0;i<N;i++){
cin>>birds[i];
}
sort(birds.begin(),birds.end());
bool frag=true;
for(int i=0;i<N-1;i++){
if(birds[i]==birds[i+1]){
frag=false;
goto END;
}
}
for(int i=0;i<N-2;i++){
if(birds[i+2]-birds[i+1]!=birds[i+1]-birds[i]){
frag=false;
break;
}
}
END:
if(frag){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}