結果

問題 No.2880 Max Sigma Mod
コンテスト
ユーザー ooaiu
提出日時 2025-09-03 15:59:36
言語 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  
実行時間 840 ms / 3,000 ms
+ 360µs
コード長 657 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,552 ms
コンパイル使用メモリ 333,860 KB
実行使用メモリ 9,924 KB
最終ジャッジ日時 2026-10-21 10:28:08
合計ジャッジ時間 16,508 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_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;
    long long base = 0;
    for (int x = 1; x <= n; x++) {
        base += m;
        long long sum = 0;
        long long end = min(m, x);
        for (long long l = 1; l <= end;) {
            long long v = x / l;
            long long r = x / v;
            r = r < m ? r : m;
            long long t = (l + r) * (r - l + 1) / 2;
            sum += t * v;
            l = r + 1;
        }
        if (ans + sum < base) ans = base - sum;
    }
    cout << ans << "\n";
}
0