結果

問題 No.1036 Make One With GCD 2
ユーザー pekempeypekempey
提出日時 2020-04-24 21:32:16
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 588 bytes
コンパイル時間 2,570 ms
コンパイル使用メモリ 205,816 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-24 17:21:08
合計ジャッジ時間 8,110 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 81 ms
5,376 KB
testcase_03 AC 22 ms
5,376 KB
testcase_04 AC 38 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 228 ms
5,376 KB
testcase_10 AC 212 ms
5,376 KB
testcase_11 AC 232 ms
5,376 KB
testcase_12 AC 212 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0