結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2016-08-07 00:31:09 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 430 bytes |
コンパイル時間 | 821 ms |
コンパイル使用メモリ | 60,280 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 05:02:38 |
合計ジャッジ時間 | 2,455 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 27 WA * 2 |
ソースコード
#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; for (int i = 1; i < N; ++i) { if ((x[i] - x[i - 1]) != d) { ans = false; break; } } cout << (ans ? "YES" : "NO") << endl; return 0; }