結果

問題 No.1036 Make One With GCD 2
ユーザー firiexpfiriexp
提出日時 2020-04-24 21:31:16
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 790 bytes
コンパイル時間 2,637 ms
コンパイル使用メモリ 117,680 KB
実行使用メモリ 7,112 KB
最終ジャッジ日時 2023-08-07 06:42:46
合計ジャッジ時間 16,648 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
7,016 KB
testcase_01 AC 136 ms
6,884 KB
testcase_02 AC 154 ms
6,892 KB
testcase_03 AC 25 ms
4,472 KB
testcase_04 AC 42 ms
5,572 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 47 ms
4,908 KB
testcase_08 AC 38 ms
4,384 KB
testcase_09 AC 281 ms
7,048 KB
testcase_10 AC 261 ms
6,596 KB
testcase_11 AC 286 ms
6,976 KB
testcase_12 AC 263 ms
6,588 KB
testcase_13 AC 433 ms
6,628 KB
testcase_14 AC 438 ms
7,008 KB
testcase_15 AC 409 ms
6,712 KB
testcase_16 AC 414 ms
6,516 KB
testcase_17 AC 428 ms
6,972 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 404 ms
6,508 KB
testcase_23 AC 300 ms
5,732 KB
testcase_24 AC 423 ms
6,584 KB
testcase_25 AC 385 ms
6,196 KB
testcase_26 AC 399 ms
6,512 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 TLE -
testcase_39 AC 153 ms
6,948 KB
testcase_40 AC 298 ms
5,888 KB
testcase_41 AC 185 ms
7,112 KB
testcase_42 AC 183 ms
7,016 KB
testcase_43 AC 183 ms
6,968 KB
testcase_44 AC 183 ms
6,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

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;
    vector<map<ll, ll>> 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