結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-30 06:18:41 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 761 bytes |
| コンパイル時間 | 3,336 ms |
| コンパイル使用メモリ | 281,856 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-07-30 06:18:48 |
| 合計ジャッジ時間 | 6,689 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
/////////////////// メイン ///////////////////
int main () {
//////////////////// 入力 ////////////////////
int n;
cin >> n;
vector<int> a(n);
for (int i=0; i<n; i++) {
cin >> a.at(i);
}
//////////////// 出力変数定義 ////////////////
string result = "YES";
//////////////////// 処理 ////////////////////
sort(a.begin(),a.end());
if (a.front()==a.back()) {
result = "NO";
} else {
for (int i=0; i<n-2; i++) {
if (a.at(i+1)*2!=a.at(i)+a.at(i+2)) {
result = "NO";
break;
}
}
}
//////////////////// 出力 ////////////////////
cout << result << endl;
//////////////////// 終了 ////////////////////
return 0;
}