結果

問題 No.1036 Make One With GCD 2
ユーザー firiexpfiriexp
提出日時 2020-04-25 17:31:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 888 bytes
コンパイル時間 2,523 ms
コンパイル使用メモリ 161,552 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-04-25 01:00:33
合計ジャッジ時間 14,954 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
7,424 KB
testcase_01 AC 109 ms
7,296 KB
testcase_02 AC 127 ms
7,296 KB
testcase_03 AC 25 ms
5,376 KB
testcase_04 AC 42 ms
5,888 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 46 ms
5,376 KB
testcase_08 AC 38 ms
5,376 KB
testcase_09 AC 289 ms
7,296 KB
testcase_10 AC 270 ms
7,040 KB
testcase_11 AC 286 ms
7,296 KB
testcase_12 AC 261 ms
7,040 KB
testcase_13 AC 409 ms
7,040 KB
testcase_14 AC 411 ms
7,168 KB
testcase_15 AC 384 ms
6,912 KB
testcase_16 AC 396 ms
6,912 KB
testcase_17 AC 404 ms
7,168 KB
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 2 ms
5,376 KB
testcase_22 AC 391 ms
6,784 KB
testcase_23 AC 284 ms
5,888 KB
testcase_24 AC 412 ms
6,912 KB
testcase_25 AC 372 ms
6,656 KB
testcase_26 AC 391 ms
6,656 KB
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 1 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 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 TLE -
testcase_39 AC 127 ms
7,296 KB
testcase_40 AC 292 ms
6,016 KB
testcase_41 AC 142 ms
7,424 KB
testcase_42 AC 145 ms
7,296 KB
testcase_43 AC 140 ms
7,424 KB
testcase_44 AC 142 ms
7,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;



static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    for (auto &&k : v) scanf("%lld", &k);
    ll ans = 0;
    using M = gp_hash_table<ll, ll>;
    vector<M> X(2);
    for (int i = 0; i < n; ++i) {
        int now = i&1, nxt = now^1;
        X[now].clear();
        for (auto &&j : X[nxt]) {
            X[now][__gcd(j.first, v[i])] += j.second;
        }
        X[now][v[i]]++;
        ans += X[now][1];
    }
    cout << ans << "\n";
    return 0;
}
0