結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
|
提出日時 | 2017-08-26 01:30:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 551 bytes |
コンパイル時間 | 478 ms |
コンパイル使用メモリ | 64,468 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 12:09:52 |
合計ジャッジ時間 | 2,143 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; typedef long long lint; #define MIN(a,b) ((a)<(b)?(a):(b)) #define MAX(a,b) ((a)>(b)?(a):(b)) int main() { lint N; cin >> N; vector<lint> x(N); for (lint i = 0; i < N; i++) cin >> x[i]; sort(x.begin(), x.end()); lint w = x[1] - x[0]; if (w == 0) { cout << "NO" << endl; return 0; } for (lint i = 0; i < x.size() - 1; i++) { if (x[i + 1] - x[i] != w) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }