結果
問題 |
No.1884 Sequence
|
ユーザー |
|
提出日時 | 2022-03-25 22:06:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 671 bytes |
コンパイル時間 | 2,213 ms |
コンパイル使用メモリ | 197,948 KB |
最終ジャッジ日時 | 2025-01-28 12:09:33 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 9 RE * 7 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() using ll = long long; int main() { int N; cin >> N; vector<ll> A(N); for (int i = 0; i < N; i++) cin >> A[i]; sort(ALL(A)); ll t = 1LL << 60; int z = 0; for (int i = 0; i < N-1; i++) { if(A[i] == 0) z++; else t = min(t, A[i+1] - A[i]); } bool ans = true; for (int i = 0; i < N-1; i++) { if(A[i] == 0) continue; int x = A[i+1] - A[i]; if(x == t) continue; if(x % t) ans = false; z -= x / t -1; if(z < 0) ans = false; } cout << (ans ? "Yes" : "No") << endl; return 0; }