結果

問題 No.1233 割り切れない気持ち
ユーザー vjudge1vjudge1
提出日時 2024-05-02 12:06:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 589 bytes
コンパイル時間 2,322 ms
コンパイル使用メモリ 199,188 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-02 12:07:07
合計ジャッジ時間 32,854 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 5 ms
5,376 KB
testcase_02 AC 4 ms
5,376 KB
testcase_03 AC 6 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 321 ms
5,376 KB
testcase_08 AC 703 ms
5,376 KB
testcase_09 AC 1,741 ms
5,632 KB
testcase_10 AC 1,905 ms
5,632 KB
testcase_11 AC 265 ms
5,376 KB
testcase_12 AC 2,332 ms
5,760 KB
testcase_13 AC 2,342 ms
5,888 KB
testcase_14 AC 2,317 ms
5,760 KB
testcase_15 AC 2,335 ms
5,888 KB
testcase_16 AC 2,322 ms
5,888 KB
testcase_17 AC 26 ms
5,888 KB
testcase_18 AC 2,309 ms
6,016 KB
testcase_19 TLE -
testcase_20 AC 16 ms
5,888 KB
testcase_21 AC 175 ms
6,016 KB
testcase_22 AC 191 ms
6,016 KB
testcase_23 AC 202 ms
6,016 KB
testcase_24 AC 224 ms
5,888 KB
testcase_25 AC 232 ms
5,888 KB
testcase_26 AC 249 ms
5,888 KB
testcase_27 AC 283 ms
5,888 KB
testcase_28 AC 277 ms
5,888 KB
testcase_29 AC 281 ms
5,760 KB
testcase_30 AC 299 ms
5,888 KB
testcase_31 AC 305 ms
5,888 KB
testcase_32 AC 322 ms
5,888 KB
testcase_33 AC 331 ms
5,888 KB
testcase_34 AC 330 ms
5,888 KB
testcase_35 AC 343 ms
5,760 KB
testcase_36 AC 356 ms
5,888 KB
testcase_37 AC 4 ms
5,376 KB
testcase_38 AC 15 ms
6,016 KB
testcase_39 AC 1,179 ms
5,760 KB
testcase_40 AC 1,174 ms
5,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

const int MAXN = 200001;

int n, a[MAXN];
ll ans, sum[MAXN], res;

int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for(int i = 1; i <= n; ++i) {
    cin >> a[i];
    sum[a[i]] += a[i], res += a[i];
  }
  for(int i = 1; i < MAXN; ++i) {
    sum[i] += sum[i - 1];
  }
  for(int i = 1; i <= n; ++i) {
    ans += res;
    for(int l = 1, r = 1; l <= a[i]; l = r + 1) {
      r = a[i] / (a[i] / l);
      ans -= 1ll * (a[i] / l) * (sum[r] - sum[l - 1]);
    }
  }
  cout << ans;
  return 0;
}
0