結果

問題 No.1233 割り切れない気持ち
ユーザー umezoumezo
提出日時 2024-01-30 04:04:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 531 ms / 3,153 ms
コード長 646 bytes
コンパイル時間 3,315 ms
コンパイル使用メモリ 214,176 KB
実行使用メモリ 17,408 KB
最終ジャッジ日時 2024-01-30 04:04:21
合計ジャッジ時間 10,804 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 11 ms
6,676 KB
testcase_03 AC 28 ms
6,676 KB
testcase_04 AC 21 ms
6,676 KB
testcase_05 AC 14 ms
6,676 KB
testcase_06 AC 15 ms
6,676 KB
testcase_07 AC 137 ms
6,676 KB
testcase_08 AC 196 ms
7,552 KB
testcase_09 AC 337 ms
11,136 KB
testcase_10 AC 354 ms
11,648 KB
testcase_11 AC 114 ms
6,676 KB
testcase_12 AC 436 ms
12,800 KB
testcase_13 AC 394 ms
12,800 KB
testcase_14 AC 407 ms
12,800 KB
testcase_15 AC 443 ms
12,800 KB
testcase_16 AC 430 ms
12,800 KB
testcase_17 AC 17 ms
6,676 KB
testcase_18 AC 531 ms
17,408 KB
testcase_19 AC 23 ms
6,676 KB
testcase_20 AC 26 ms
6,676 KB
testcase_21 AC 35 ms
6,676 KB
testcase_22 AC 35 ms
6,676 KB
testcase_23 AC 34 ms
6,676 KB
testcase_24 AC 34 ms
6,676 KB
testcase_25 AC 34 ms
6,676 KB
testcase_26 AC 33 ms
6,676 KB
testcase_27 AC 37 ms
6,676 KB
testcase_28 AC 37 ms
6,676 KB
testcase_29 AC 36 ms
6,676 KB
testcase_30 AC 36 ms
6,676 KB
testcase_31 AC 37 ms
6,676 KB
testcase_32 AC 36 ms
6,676 KB
testcase_33 AC 36 ms
6,676 KB
testcase_34 AC 36 ms
6,676 KB
testcase_35 AC 36 ms
6,676 KB
testcase_36 AC 36 ms
6,676 KB
testcase_37 AC 2 ms
6,676 KB
testcase_38 AC 26 ms
6,676 KB
testcase_39 AC 270 ms
11,136 KB
testcase_40 AC 268 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin>>n;
  ll sum=0;
  vector<ll> A(n);
  map<ll,ll> m;
  rep(i,n){
    cin>>A[i];
    sum+=A[i];
    m[A[i]]++;
  }
  sum*=n;
  sort(ALL(A));
  
  ll cnt=0;
  for(auto [a,b]:m){
    ll tmp=0;
    for(int i=1;i*a<=200000;i++){
      auto l=lower_bound(ALL(A),i*a)-A.begin();
      auto r=lower_bound(ALL(A),(i+1)*a)-A.begin();
      tmp+=(r-l)*i;
    }
    cnt+=a*b*tmp;
  }
  cout<<sum-cnt<<endl;
    
  return 0;
}
0