結果
| 問題 |
No.2811 Calculation Within Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-15 22:25:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 210 ms / 2,000 ms |
| コード長 | 808 bytes |
| コンパイル時間 | 1,100 ms |
| コンパイル使用メモリ | 113,708 KB |
| 最終ジャッジ日時 | 2025-02-23 22:47:12 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#include<iostream>
#include<string>
#include<queue>
#include<vector>
#include<cassert>
#include<random>
#include<set>
#include<map>
#include<cassert>
#include<unordered_map>
#include<bitset>
#include<numeric>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf=1<<30;
const ll INF=1LL<<62;
typedef pair<int,ll> P;
typedef pair<int,P> PP;
const ll MOD=998244353;
ll gcd(ll a,ll b){
if(b==0) return a;
return gcd(b,a%b);
}
int main(){
int a,b;
cin>>a>>b;
vector<ll> T(a),S(b);
for(int i=0;i<a;i++)cin>>T[i];
for(int i=0;i<b;i++)cin>>S[i];
ll g=0;
for(int i=0;i<a;i++){
g=gcd(T[i],g);
}
for(int i=0;i<b;i++){
if(S[i]%g!=0){
cout<<"No"<<endl;
return 0;
}
}
cout<<"Yes"<<endl;
}