結果
問題 |
No.2811 Calculation Within Sequence
|
ユーザー |
|
提出日時 | 2024-07-19 21:25:38 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 202 ms / 2,000 ms |
コード長 | 880 bytes |
コンパイル時間 | 5,211 ms |
コンパイル使用メモリ | 308,820 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 21:25:56 |
合計ジャッジ時間 | 12,426 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using mint = atcoder::static_modint<998244353>; //using mint = atcoder::static_modint<1000000007>; using namespace std; using namespace atcoder; using ld = long double; using ll = long long; #define mp(a,b) make_pair(a,b) #define rep(i,s,n) for(int i=s; i<n; i++) const vector<int> dx{1,0,-1,0},dy{0,1,0,-1}; template<typename T> void compress(vector<T>&a, bool is_unique=false){ auto b=a; sort(b.begin(),b.end()); if(is_unique){ auto p=unique(b.begin(),b.end()); b.erase(p,b.end()); } for(auto&x:a)x=lower_bound(b.begin(),b.end(),x)-b.begin(); } int main(){ int a,b; cin >> a >> b; vector<int> t(a),s(b); rep(i,0,a)cin >> t[i]; rep(i,0,b)cin >> s[i]; int g=t[0]; for(auto x:t)g=gcd(g,x); string ans="Yes"; rep(i,0,b)if(s[i]%g!=0)ans="No"; cout << ans; }