結果

問題 No.1233 割り切れない気持ち
ユーザー tko919tko919
提出日時 2021-08-27 17:47:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 72 ms / 3,153 ms
コード長 879 bytes
コンパイル時間 2,395 ms
コンパイル使用メモリ 203,564 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-30 21:20:49
合計ジャッジ時間 6,514 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,812 KB
testcase_01 AC 10 ms
6,944 KB
testcase_02 AC 10 ms
6,940 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 10 ms
6,944 KB
testcase_05 AC 10 ms
6,944 KB
testcase_06 AC 10 ms
6,940 KB
testcase_07 AC 24 ms
6,940 KB
testcase_08 AC 34 ms
6,944 KB
testcase_09 AC 58 ms
6,940 KB
testcase_10 AC 61 ms
6,940 KB
testcase_11 AC 22 ms
6,944 KB
testcase_12 AC 69 ms
6,944 KB
testcase_13 AC 69 ms
6,940 KB
testcase_14 AC 71 ms
6,940 KB
testcase_15 AC 68 ms
6,940 KB
testcase_16 AC 68 ms
6,944 KB
testcase_17 AC 41 ms
6,944 KB
testcase_18 AC 68 ms
6,940 KB
testcase_19 AC 72 ms
6,940 KB
testcase_20 AC 40 ms
6,940 KB
testcase_21 AC 52 ms
6,940 KB
testcase_22 AC 52 ms
6,944 KB
testcase_23 AC 52 ms
6,940 KB
testcase_24 AC 51 ms
6,940 KB
testcase_25 AC 52 ms
6,940 KB
testcase_26 AC 52 ms
6,944 KB
testcase_27 AC 60 ms
6,940 KB
testcase_28 AC 59 ms
6,944 KB
testcase_29 AC 60 ms
6,940 KB
testcase_30 AC 59 ms
6,944 KB
testcase_31 AC 60 ms
6,944 KB
testcase_32 AC 61 ms
6,940 KB
testcase_33 AC 60 ms
6,944 KB
testcase_34 AC 62 ms
6,940 KB
testcase_35 AC 60 ms
6,940 KB
testcase_36 AC 60 ms
6,944 KB
testcase_37 AC 11 ms
6,940 KB
testcase_38 AC 41 ms
6,940 KB
testcase_39 AC 53 ms
6,940 KB
testcase_40 AC 54 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
using ll=long long int;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

ll cnt[201010];

int main(){
   int n;
   cin>>n;
   vector<ll> a(n);
   rep(i,0,n)cin>>a[i];

   ll res=0;
   rep(i,0,n){
      res+=a[i];
      cnt[a[i]]++;
   }
   res*=n;
   rep(x,0,201000)cnt[x+1]+=cnt[x];
   rep(y,1,200001){
      for(ll x=1;;x++){
         ll L=x*y-1,R=min((x+1)*y-1,200010LL);
         if(L>200010)break;
         res-=(cnt[y]-cnt[y-1])*y*(cnt[R]-cnt[L])*x;
      }
   }
   cout<<res<<'\n';
   return 0;
}
0