結果
問題 |
No.1233 割り切れない気持ち
|
ユーザー |
![]() |
提出日時 | 2024-05-02 10:30:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 598 bytes |
コンパイル時間 | 1,916 ms |
コンパイル使用メモリ | 192,272 KB |
最終ジャッジ日時 | 2025-02-21 10:12:09 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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(){ 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]; */