結果
| 問題 |
No.1233 割り切れない気持ち
|
| コンテスト | |
| ユーザー |
otogawa
|
| 提出日時 | 2025-04-22 05:07:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 727 bytes |
| コンパイル時間 | 2,462 ms |
| コンパイル使用メモリ | 200,416 KB |
| 実行使用メモリ | 8,864 KB |
| 最終ジャッジ日時 | 2025-04-22 05:08:15 |
| 合計ジャッジ時間 | 17,663 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 TLE * 1 -- * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int ll
using ll = long long;
const int MOD = 1e9 + 7;
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
int n; cin >> n;
vector<int> a(n);
for (auto &i : a) cin >> i;
sort(a.begin(), a.end());
vector suff = a;
suff.push_back(0);
for (int i = n - 1; i >= 0; i--) {
suff[i] += suff[i + 1];
}
int ans = 0;
for (int i = 0; i < n; i++) {
int l = 0;
for (int j = 0; j*a[i] <= a[n - 1] && l < n; j++) {
int r = lower_bound(a.begin(), a.end(), (j + 1)*a[i]) - a.begin();
ans += (suff[l] - suff[r]) - (r - l) * j * a[i];
l = r;
}
}
cout << ans << endl;
}
otogawa