結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2016-08-07 00:31:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 44 ms / 2,000 ms |
コード長 | 439 bytes |
コンパイル時間 | 500 ms |
コンパイル使用メモリ | 60,232 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 11:31:46 |
合計ジャッジ時間 | 2,282 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <iostream> #include <sstream> #include <algorithm> #include <cstdio> using namespace std; int main(int argc, char *argv[]) { int N; int x[100000]; cin >> N; for (int i = 0; i < N; ++i) { cin >> x[i]; } sort(x, x + N); int d = x[1] - x[0]; bool ans = x[0] >= 0 && d > 0; for (int i = 1; i < N; ++i) { if ((x[i] - x[i - 1]) != d) { ans = false; break; } } cout << (ans ? "YES" : "NO") << endl; return 0; }