結果
| 問題 |
No.1884 Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-25 22:24:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,541 bytes |
| コンパイル時間 | 2,080 ms |
| コンパイル使用メモリ | 206,760 KB |
| 最終ジャッジ日時 | 2025-01-28 12:17:21 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 WA * 10 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
using ll = int64_t;
using ld = long double;
using ull = unsigned long long;
#define ALL(x) x.begin(),x.end()
#define rep(iter,from,to) for(ll iter=from;iter<to;++iter)
#define fore(variable,container) for(auto& variable:container)
#define forc(variable,container) for(auto& variable:container) cout<<variable<<endl;
const ll MOD = 1e9 + 7;
const ll INF = 1e17;
const vector<ll> dx{ 1,0,-1,0 }, dy{ 0,1,0,-1 };
//#######################################################################
void op(vector<ll> vec) {
ll size = (ll)vec.size();
for (ll i = 0; i < size - 1; ++i) cout << vec[i] << " ";
cout << vec.back() << endl;
}
void op(vector<vector<ll>> vec) {
ll height = (ll)vec.size();
ll width = (ll)vec[0].size();
for (ll i = 0; i < height; ++i) {
for (ll j = 0; j < width - 1; ++j) cout << vec[i][j] << " ";
cout << vec[i].back() << endl;
}
}
void twoText(bool identifier, string outTrue, string outFalse) {
if (identifier) cout << outTrue << endl;
else cout << outFalse << endl;
}
void twoText(bool identifier) {
if (identifier) cout << "Yes" << endl;
else cout << "No" << endl;
}
template <class T>
T vecsum(vector<T>& vec) {
return accumulate(ALL(vec), (T)0);
}
template<class T, ll>
T vecsum(vector<T>& vec, ll K) {
ll ret = 0;
rep(i, 0, K) ret += vec[i];
return ret;
}
template <class T>
struct grid {
vector<vector<T>> field;
grid(ll height, ll width) { field = vector<vector<T>>(height, vector<T>(width, (T)0)); }
void input() { rep(i, 0, field.size()) rep(j, 0, field[i].size()) cin >> field[i][j]; }
};
//#########################################################################
void solve() {
ll N; cin >> N;
ll zero = 0;
vector<ll> a; rep(i, 0, N) {
ll v; cin >> v;
if (v == 0) zero++;
else a.emplace_back(v);
}
if (a.empty()) { cout << "Yes" << endl; return; }
sort(ALL(a));
set<ll> diff;
rep(i, 0, a.size() - 1) {
diff.emplace(a[i + 1] - a[i]);
}
ll mini = *diff.begin();
ll cnt = 0;
if (mini == 0) {
twoText(diff.size() == 1);
return;
}
fore(x, diff) {
if (x % mini != 0) {
cout << "No" << endl;
return;
}
if (mini != x) cnt += x / mini;
}
twoText(cnt <= zero);
}
int main(void) {
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(15);
solve();
}