結果

問題 No.2880 Max Sigma Mod
コンテスト
ユーザー ooaiu
提出日時 2025-09-03 15:46:45
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 839 ms / 3,000 ms
+ 170µs
コード長 624 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,257 ms
コンパイル使用メモリ 333,776 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-10-21 10:27:30
合計ジャッジ時間 15,646 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    long long ans = 0;
    for (int x = 1; x <= n; x++) {
        long long base = (long long)x * m;
        long long sum = 0;
        for (long long l = 1; l <= min(m, x);) {
            long long v = x / l;
            long long r = x / v;
            r = min<long long>(r, m);
            long long t = (l + r) * (r - l + 1) / 2;
            sum += t * v;
            l = r + 1;
        }
        ans = max(ans, base - sum);
    }
    cout << ans << "\n";
}
0