結果
| 問題 |
No.1233 割り切れない気持ち
|
| コンテスト | |
| ユーザー |
otogawa
|
| 提出日時 | 2025-04-22 05:02:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 753 bytes |
| コンパイル時間 | 2,293 ms |
| コンパイル使用メモリ | 201,124 KB |
| 実行使用メモリ | 9,120 KB |
| 最終ジャッジ日時 | 2025-04-22 05:03:32 |
| 合計ジャッジ時間 | 34,899 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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++) {
for (int j = 0; j*a[i] <= a[n - 1]; j++) {
int l = lower_bound(a.begin(), a.end(), j*a[i]) - a.begin();
int r = lower_bound(a.begin(), a.end(), (j + 1)*a[i]) - a.begin();
ans += (suff[l] - suff[r]) - (r - l) * j * a[i];
}
}
cout << ans << endl;
}
otogawa