結果
問題 | No.2880 Max Sigma Mod |
ユーザー |
|
提出日時 | 2024-09-08 13:10:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 3,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 2,220 ms |
コンパイル使用メモリ | 196,216 KB |
最終ジャッジ日時 | 2025-02-24 05:28:50 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 48 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main(){ios::sync_with_stdio(false);cin.tie(0);int n, m;cin >> n >> m;const int c = max(2 * n, 2 * m);vector<ll> imos(c + 1), d(c + 1);for(int i = 2; i <= m; i++){for(int j = 0; j <= n; j += i){imos[j + 1]++;imos[j + i]--;d[j + i] -= i - 1;}}ll cur = 0, ans = 0, df = 0;for(int i = 1; i <= n; i++){imos[i + 1] += imos[i];cur += imos[i] + d[i];ans = max(ans, cur);}cout << ans << '\n';}