結果
| 問題 |
No.1884 Sequence
|
| コンテスト | |
| ユーザー |
gazelle
|
| 提出日時 | 2022-03-25 21:40:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,213 bytes |
| コンパイル時間 | 1,991 ms |
| コンパイル使用メモリ | 199,972 KB |
| 最終ジャッジ日時 | 2025-01-28 11:51:18 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 29 WA * 5 RE * 6 |
ソースコード
#include <bits/stdc++.h>
#define FOR(i, n, m) for (long long i = (n); i < (long long)(m); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll inf = 1000000000;
constexpr ll mod = 998244353;
constexpr ld eps = 1e-6;
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
os << to_string(p.first) << " " << to_string(p.second);
return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
REP(i, v.size()) {
if (i) os << " ";
os << v[i];
}
return os;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<ll> a;
REP(i, n) {
ll num;
cin >> num;
if (num != 0) a.pb(num);
}
if ((int)a.size() <= 1) {
cout << "Yes" << endl;
return 0;
}
sort(ALL(a));
ll g = a[1] - a[0];
FOR(i, 1, a.size()) g = gcd(g, a[i] - a[i - 1]);
if ((a.back() - a.front()) / g <= n - 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
gazelle