結果
| 問題 |
No.2811 Calculation Within Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-19 21:23:34 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 2,000 ms |
| コード長 | 399 bytes |
| コンパイル時間 | 1,851 ms |
| コンパイル使用メモリ | 192,408 KB |
| 最終ジャッジ日時 | 2025-02-23 16:17:54 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N,M; cin >> N >> M;
int g = 0;
while(N--){
int a; cin >> a;
g = gcd(a,g);
}
bool ok = true;
while(M--){
int b; cin >> b;
if(b%g) ok = false;
}
if(ok) cout << "Yes" << endl;
else cout << "No" << endl;
}