結果

問題 No.1233 割り切れない気持ち
ユーザー monnumonnu
提出日時 2020-10-03 19:27:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 80 ms / 3,153 ms
コード長 585 bytes
コンパイル時間 1,717 ms
コンパイル使用メモリ 171,188 KB
実行使用メモリ 8,044 KB
最終ジャッジ日時 2023-09-25 05:40:10
合計ジャッジ時間 6,248 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,124 KB
testcase_01 AC 8 ms
6,224 KB
testcase_02 AC 8 ms
6,096 KB
testcase_03 AC 8 ms
6,160 KB
testcase_04 AC 8 ms
6,156 KB
testcase_05 AC 8 ms
6,228 KB
testcase_06 AC 8 ms
6,484 KB
testcase_07 AC 25 ms
6,600 KB
testcase_08 AC 38 ms
6,656 KB
testcase_09 AC 66 ms
7,608 KB
testcase_10 AC 70 ms
7,812 KB
testcase_11 AC 24 ms
6,360 KB
testcase_12 AC 79 ms
7,744 KB
testcase_13 AC 80 ms
7,780 KB
testcase_14 AC 79 ms
7,920 KB
testcase_15 AC 80 ms
7,876 KB
testcase_16 AC 79 ms
7,740 KB
testcase_17 AC 39 ms
7,672 KB
testcase_18 AC 68 ms
7,812 KB
testcase_19 AC 69 ms
7,708 KB
testcase_20 AC 39 ms
7,780 KB
testcase_21 AC 56 ms
7,896 KB
testcase_22 AC 56 ms
7,812 KB
testcase_23 AC 57 ms
7,812 KB
testcase_24 AC 56 ms
7,676 KB
testcase_25 AC 56 ms
7,684 KB
testcase_26 AC 57 ms
8,044 KB
testcase_27 AC 64 ms
7,900 KB
testcase_28 AC 64 ms
7,708 KB
testcase_29 AC 64 ms
7,676 KB
testcase_30 AC 64 ms
7,808 KB
testcase_31 AC 64 ms
7,896 KB
testcase_32 AC 64 ms
7,856 KB
testcase_33 AC 63 ms
7,900 KB
testcase_34 AC 64 ms
7,872 KB
testcase_35 AC 64 ms
7,680 KB
testcase_36 AC 64 ms
7,896 KB
testcase_37 AC 8 ms
6,312 KB
testcase_38 AC 40 ms
7,736 KB
testcase_39 AC 54 ms
7,672 KB
testcase_40 AC 54 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define MOD 998244353
using ll=long long;
using Graph=vector<vector<int>>;

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  sort(A.begin(),A.end());

  vector<ll> cnt(200001,0);
  for(int i=0;i<N;i++){
    cnt[A[i]]++;
  }
  vector<ll> sum(200001,0);
  for(int i=1;i<=200000;i++){
    sum[i]+=sum[i-1]+(ll)N;
    for(int j=1;i*j<=200000;j++){
      sum[i*j]-=(ll)cnt[i]*(ll)i;
    }
  }

  ll ans=0;
  for(int i=0;i<N;i++){
    ans+=sum[A[i]];
  }
  cout<<ans<<endl;
}
0