結果

問題 No.1233 割り切れない気持ち
ユーザー tko919tko919
提出日時 2021-08-27 17:47:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 68 ms / 3,153 ms
コード長 879 bytes
コンパイル時間 2,125 ms
コンパイル使用メモリ 199,484 KB
実行使用メモリ 6,480 KB
最終ジャッジ日時 2023-08-13 02:52:54
合計ジャッジ時間 7,299 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,932 KB
testcase_01 AC 10 ms
5,008 KB
testcase_02 AC 10 ms
4,876 KB
testcase_03 AC 10 ms
4,932 KB
testcase_04 AC 10 ms
4,928 KB
testcase_05 AC 9 ms
4,868 KB
testcase_06 AC 10 ms
4,868 KB
testcase_07 AC 23 ms
5,052 KB
testcase_08 AC 33 ms
5,380 KB
testcase_09 AC 54 ms
5,912 KB
testcase_10 AC 57 ms
6,076 KB
testcase_11 AC 21 ms
5,144 KB
testcase_12 AC 64 ms
6,216 KB
testcase_13 AC 65 ms
6,268 KB
testcase_14 AC 64 ms
6,212 KB
testcase_15 AC 65 ms
6,104 KB
testcase_16 AC 64 ms
6,156 KB
testcase_17 AC 38 ms
6,152 KB
testcase_18 AC 64 ms
6,172 KB
testcase_19 AC 68 ms
6,308 KB
testcase_20 AC 39 ms
6,240 KB
testcase_21 AC 50 ms
6,480 KB
testcase_22 AC 49 ms
6,224 KB
testcase_23 AC 49 ms
6,264 KB
testcase_24 AC 49 ms
6,148 KB
testcase_25 AC 50 ms
6,220 KB
testcase_26 AC 49 ms
6,148 KB
testcase_27 AC 56 ms
6,200 KB
testcase_28 AC 56 ms
6,324 KB
testcase_29 AC 56 ms
6,216 KB
testcase_30 AC 56 ms
6,432 KB
testcase_31 AC 56 ms
6,300 KB
testcase_32 AC 57 ms
6,312 KB
testcase_33 AC 57 ms
6,272 KB
testcase_34 AC 57 ms
6,212 KB
testcase_35 AC 57 ms
6,244 KB
testcase_36 AC 56 ms
6,192 KB
testcase_37 AC 10 ms
5,000 KB
testcase_38 AC 39 ms
6,220 KB
testcase_39 AC 51 ms
6,160 KB
testcase_40 AC 51 ms
6,268 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