結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2023-11-21 15:01:54 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 448 bytes |
コンパイル時間 | 2,046 ms |
コンパイル使用メモリ | 197,032 KB |
最終ジャッジ日時 | 2025-02-17 22:43:36 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) int main() { // Input int N; cin >> N; vector<int> x(N); rep(i, N) cin >> x[i]; // Judge sort(x.begin(), x.end()); string ans = "YES"; int dist = x[1] - x[0]; if (dist == 0) ans = "NO"; rep(i, N-1) if (x[i+1] - x[i] != dist) ans = "NO"; // Output cout << ans << endl; }