結果
問題 |
No.1233 割り切れない気持ち
|
ユーザー |
![]() |
提出日時 | 2024-05-02 10:32:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 637 bytes |
コンパイル時間 | 2,029 ms |
コンパイル使用メモリ | 190,872 KB |
最終ジャッジ日時 | 2025-02-21 10:12:51 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 38 TLE * 1 |
ソースコード
#include<bits/stdc++.h> using namespace std; using LL = long long; const int N = 2e5 + 5, MAXN = 2e5; int n, a[N]; LL sum[N], cnt[N], ans, now; int main(){ ios::sync_with_stdio(0), cin.tie(0); cin >> n; for(int i = 1; i <= n; ++i){ cin >> a[i]; cnt[a[i]] += a[i]; } for(int i = 0; i <= MAXN; ++i){ sum[i] = sum[i - 1] + cnt[i]; } for(int i = 1; i <= n; ++i){ now = 0; for(int l = 1, r; l <= a[i]; l = r + 1){ r = a[i] / (a[i] / l); now += 1ll * a[i] / l * (sum[r] - sum[l - 1]); } ans += 1ll * n * a[i] - now; } cout << ans; return 0; } /* a[i] - (a[i] / a[j]) * a[j]; */