結果

問題 No.2811 Calculation Within Sequence
ユーザー mogura
提出日時 2024-07-19 21:41:58
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 6,648 ms
コンパイル使用メモリ 179,840 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-07-19 21:42:20
合計ジャッジ時間 8,368 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a));
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a),0LL)
using ll=long long;
using ld=long double;
using ull=unsigned long;
ll MOD=998244353;
ll inf=1e15;
using mint = static_modint<998244353>;
int main(){
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a,b;cin>>a>>b;
  vector<ll>T(a),S(b);
  rep(i,a){cin>>T[i];}
  rep(i,b){cin>>S[i];}
  ll gt=(T[0],T[1]);
  ll gs=(S[0],S[1]);
  rep(i,a){gt=gcd(gt,T[i]);}
  rep(i,b){gs=gcd(gs,S[i]);}
  if(gcd(gt,gs)==gt){
  	cout<<"Yes"<<endl;
  	return 0;
  }
  cout<<"No"<<endl;
}
0