結果
問題 |
No.2811 Calculation Within Sequence
|
ユーザー |
|
提出日時 | 2024-07-20 12:57:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 65 ms / 2,000 ms |
コード長 | 508 bytes |
コンパイル時間 | 1,905 ms |
コンパイル使用メモリ | 196,076 KB |
最終ジャッジ日時 | 2025-02-23 17:01:46 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; template<class T> istream& operator >> (istream& is, vector<T>& vec) { for(T& x : vec) is >> x; return is; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int a, b, g = 0; cin >> a >> b; vector<int> T(a), S(b); cin >> T >> S; for(auto &&v : T) g = gcd(g, v); for(auto &&v : S) { if(v % g != 0){ cout << "No\n"; return 0; } } cout << "Yes\n"; }