結果
| 問題 |
No.1233 割り切れない気持ち
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-08-15 15:45:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 727 bytes |
| コンパイル時間 | 2,265 ms |
| コンパイル使用メモリ | 190,128 KB |
| 実行使用メモリ | 6,784 KB |
| 最終ジャッジ日時 | 2025-08-15 15:45:08 |
| 合計ジャッジ時間 | 4,382 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 WA * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int N = 2e5 + 1;
int n;
ll a[N];
ll cnt[N];
ll ans;
int main(){
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i ++){
cin >> a[i];
cnt[a[i]] ++;
ans += a[i] * n;
}
for(int i = 1; i < N; i ++){
cnt[i] += cnt[i - 1];
}
for(int mod = 1; mod < N; mod ++){
for(int k = 0; (k + 1) * mod - 1 < N; k ++){
ans -= (cnt[(k + 1) * mod - 1] - (k * mod - 1 >= 0 ? cnt[k * mod - 1] : 0)) * (cnt[mod] - cnt[mod - 1]) * (mod * k);
}
}
cout << ans;
return 0;
}
/***
3
1 5 3
8
8 8 8 8 8 8 8 8
***/
vjudge1