結果

問題 No.2880 Max Sigma Mod
ユーザー karinohito
提出日時 2024-09-08 13:14:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 506 bytes
コンパイル時間 2,050 ms
コンパイル使用メモリ 195,264 KB
最終ジャッジ日時 2025-02-24 05:29:15
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 14 TLE * 2 -- * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/maxflow>
using namespace atcoder;
using namespace std;
using ll=long long;

int main(){
    ll N,M;
    cin>>N>>M;
    
    ll an=0,id=0;
    for(ll x=1;x<=N;x++){
        ll res=M*x;
        ll d=1;
        while(d<=N){
            ll L=min(x/d,M);
            ll R=x/(d+1);
            if(R<L){
                res-=d*(L*(L+1)/2-R*(R+1)/2);
            }
            if(R==0)break;
            d=x/R;
        }
        an=max(an,res);
    }
    cout<<an<<endl;
}
0