結果

問題 No.1233 割り切れない気持ち
ユーザー 鴨志田卓鴨志田卓
提出日時 2023-08-01 22:37:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 247 ms / 3,153 ms
コード長 553 bytes
コンパイル時間 2,015 ms
コンパイル使用メモリ 195,784 KB
実行使用メモリ 25,728 KB
最終ジャッジ日時 2024-04-19 23:32:16
合計ジャッジ時間 11,917 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 198 ms
24,832 KB
testcase_01 AC 188 ms
24,960 KB
testcase_02 AC 179 ms
24,832 KB
testcase_03 AC 173 ms
24,940 KB
testcase_04 AC 174 ms
24,704 KB
testcase_05 AC 165 ms
24,832 KB
testcase_06 AC 175 ms
24,832 KB
testcase_07 AC 187 ms
25,184 KB
testcase_08 AC 185 ms
25,344 KB
testcase_09 AC 202 ms
25,472 KB
testcase_10 AC 216 ms
25,472 KB
testcase_11 AC 182 ms
24,880 KB
testcase_12 AC 203 ms
25,600 KB
testcase_13 AC 219 ms
25,600 KB
testcase_14 AC 178 ms
25,472 KB
testcase_15 AC 197 ms
25,600 KB
testcase_16 AC 201 ms
25,600 KB
testcase_17 AC 203 ms
24,860 KB
testcase_18 AC 241 ms
25,728 KB
testcase_19 AC 237 ms
24,832 KB
testcase_20 AC 176 ms
24,704 KB
testcase_21 AC 197 ms
24,960 KB
testcase_22 AC 218 ms
24,804 KB
testcase_23 AC 205 ms
24,832 KB
testcase_24 AC 212 ms
24,832 KB
testcase_25 AC 211 ms
24,832 KB
testcase_26 AC 197 ms
24,960 KB
testcase_27 AC 194 ms
25,600 KB
testcase_28 AC 247 ms
25,600 KB
testcase_29 AC 246 ms
25,572 KB
testcase_30 AC 207 ms
25,600 KB
testcase_31 AC 212 ms
25,472 KB
testcase_32 AC 220 ms
25,424 KB
testcase_33 AC 211 ms
25,472 KB
testcase_34 AC 179 ms
25,216 KB
testcase_35 AC 182 ms
25,472 KB
testcase_36 AC 177 ms
25,088 KB
testcase_37 AC 176 ms
24,960 KB
testcase_38 AC 216 ms
24,960 KB
testcase_39 AC 207 ms
25,728 KB
testcase_40 AC 206 ms
25,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 10;

int n, a[N];

vector<int> sub[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    for(int i = 1, x; i <= n; i ++) {
        cin >> x;
        a[x] ++;
    }

    long long ans = 0, mod = 0;

    for(int i = 1; i < N; i ++) {
        for(int j = i; j < N; j += i)
            sub[j].push_back(i);
        for(auto x : sub[i])
            mod += x * (long long)a[x];
        
        ans += a[i] * ((long long)i * n - mod);
    }
    cout << ans;
}
0