結果
問題 | No.917 Make One With GCD |
ユーザー |
|
提出日時 | 2020-04-12 15:49:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 638 bytes |
コンパイル時間 | 1,887 ms |
コンパイル使用メモリ | 178,960 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-22 02:40:15 |
合計ジャッジ時間 | 2,806 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 14 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); i ++) using namespace std; typedef long long ll; typedef pair<ll,ll> PL; typedef pair<int,int> P; const int INF = 1e9; const ll MOD = 1e9 + 7; const vector<int> dy = {-1,0,1,0}; const vector<int> dx = {0,1,0,-1}; int main() { int n; cin >> n; vector<int> a(n); rep(i,n) cin >> a[i]; map<int,int> dp; for (int x:a) { map<int,int> now; now[x] = 1; for (auto p:dp) { now[p.first] += p.second; now[__gcd(x,p.first)] += p.second; } dp = now; } cout << dp[1] << endl; return 0; }