結果
| 問題 | 
                            No.2811 Calculation Within Sequence
                             | 
                    
| コンテスト | |
| ユーザー | 
                             mogura
                         | 
                    
| 提出日時 | 2024-07-19 21:36:11 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 824 bytes | 
| コンパイル時間 | 6,599 ms | 
| コンパイル使用メモリ | 179,072 KB | 
| 実行使用メモリ | 6,528 KB | 
| 最終ジャッジ日時 | 2024-07-19 21:36:22 | 
| 合計ジャッジ時間 | 10,512 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 34 WA * 7 | 
ソースコード
#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||__gcd(gt,gs)!=1){
  	cout<<"Yes"<<endl;
  	return 0;
  }
  cout<<"No"<<endl;
}
            
            
            
        
            
mogura