結果
問題 | No.1036 Make One With GCD 2 |
ユーザー |
|
提出日時 | 2020-04-24 21:32:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 588 bytes |
コンパイル時間 | 3,002 ms |
コンパイル使用メモリ | 204,204 KB |
最終ジャッジ日時 | 2025-01-09 23:15:42 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 WA * 24 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;#define rep(i, n) for (int i = 0; i < (n); i++)#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)#define range(a) a.begin(), a.end()int main() {cin.tie(nullptr);ios::sync_with_stdio(false);int N; cin >> N;vector<int> A(N); rep(i, N) cin >> A[i];map<int, ll> dp;ll ans = 0;rep(i, N) {map<int, ll> ep;for (auto [k, v] : dp) {ep[gcd(k, A[i])] += v;}ep[A[i]]++;dp = ep;ans += dp[1];}cout << ans << endl;}