結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-08 12:17:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 536 bytes |
| コンパイル時間 | 1,723 ms |
| コンパイル使用メモリ | 171,948 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-15 14:31:41 |
| 合計ジャッジ時間 | 4,052 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
}