結果
問題 | No.2811 Calculation Within Sequence |
ユーザー | Fu_L |
提出日時 | 2024-07-19 21:24:48 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 748 bytes |
コンパイル時間 | 7,248 ms |
コンパイル使用メモリ | 275,188 KB |
実行使用メモリ | 6,528 KB |
最終ジャッジ日時 | 2024-07-19 21:24:59 |
合計ジャッジ時間 | 9,848 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define rep(i, a, b) for(ll i = a; i < b; ++i) #define rrep(i, a, b) for(ll i = a; i >= b; --i) constexpr ll inf = 4e18; struct SetupIO { SetupIO() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(30); } } setup_io; int main(void) { ll a, b; cin >> a >> b; vector<ll> t(a), s(b); ll g = 0; rep(i, 0, a) { cin >> t[i]; g = gcd(g, t[i]); } bool ans = true; rep(i, 0, b) { cin >> s[i]; if(s[i] % g != 0) { ans = false; } } if(ans) { cout << "Yes" << '\n'; } else { cout << "No" << '\n'; } }