結果

問題 No.1233 割り切れない気持ち
ユーザー kyoprounokyoprouno
提出日時 2020-09-26 16:22:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 68 ms / 3,153 ms
コード長 917 bytes
コンパイル時間 1,956 ms
コンパイル使用メモリ 175,224 KB
実行使用メモリ 7,916 KB
最終ジャッジ日時 2023-09-11 13:32:20
合計ジャッジ時間 5,497 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
6,200 KB
testcase_01 AC 7 ms
6,272 KB
testcase_02 AC 7 ms
6,324 KB
testcase_03 AC 7 ms
6,176 KB
testcase_04 AC 7 ms
6,128 KB
testcase_05 AC 7 ms
6,192 KB
testcase_06 AC 7 ms
6,176 KB
testcase_07 AC 21 ms
6,524 KB
testcase_08 AC 31 ms
6,688 KB
testcase_09 AC 54 ms
7,500 KB
testcase_10 AC 58 ms
7,524 KB
testcase_11 AC 20 ms
6,476 KB
testcase_12 AC 68 ms
7,856 KB
testcase_13 AC 66 ms
7,796 KB
testcase_14 AC 67 ms
7,908 KB
testcase_15 AC 68 ms
7,916 KB
testcase_16 AC 68 ms
7,916 KB
testcase_17 AC 36 ms
7,840 KB
testcase_18 AC 63 ms
7,708 KB
testcase_19 AC 66 ms
7,860 KB
testcase_20 AC 36 ms
7,916 KB
testcase_21 AC 46 ms
7,856 KB
testcase_22 AC 48 ms
7,776 KB
testcase_23 AC 47 ms
7,836 KB
testcase_24 AC 47 ms
7,776 KB
testcase_25 AC 47 ms
7,788 KB
testcase_26 AC 48 ms
7,840 KB
testcase_27 AC 55 ms
7,840 KB
testcase_28 AC 55 ms
7,840 KB
testcase_29 AC 55 ms
7,900 KB
testcase_30 AC 55 ms
7,732 KB
testcase_31 AC 55 ms
7,904 KB
testcase_32 AC 55 ms
7,796 KB
testcase_33 AC 55 ms
7,856 KB
testcase_34 AC 54 ms
7,796 KB
testcase_35 AC 54 ms
7,856 KB
testcase_36 AC 54 ms
7,856 KB
testcase_37 AC 7 ms
6,272 KB
testcase_38 AC 35 ms
7,708 KB
testcase_39 AC 49 ms
7,800 KB
testcase_40 AC 50 ms
7,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

const ll mod=1e9+7;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n),cumsum(200001),divide(200001);
    ll ans=0;
    rep(i,n){
        cin >> a[i];
        cumsum[a[i]]++;
        ans+=a[i];
    }
    ans*=n;
    for(ll i=200000;i>0;i--) cumsum[i-1]+=cumsum[i];
    for(ll i=1;i<=200000;i++)for(ll j=i;j<=200000;j+=i) divide[i]+=cumsum[j];
    rep(i,n) ans-=divide[a[i]]*a[i];
    cout << ans << endl;
    return 0;
}
0