結果
| 問題 | No.406 鴨等間隔の法則 |
| コンテスト | |
| ユーザー |
かぼちゃ
|
| 提出日時 | 2018-03-26 23:32:17 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 436 bytes |
| 記録 | |
| コンパイル時間 | 534 ms |
| コンパイル使用メモリ | 83,168 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-03-29 02:45:18 |
| 合計ジャッジ時間 | 2,087 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int dx,n;
cin >> n;
vector<int> x(n);
for(int i = 0;i < n;i++){
cin >> x[i];
}
sort(x.begin(),x.end());
dx = x[1] - x[0];
string ans = "YES\n";
if(dx == 0)ans = "NO\n";
for(int i = 2;i < n;i++){
if(x[i]-x[i-1] != dx)ans = "NO\n";
}
cout << ans;
return 0;
}
かぼちゃ