結果
問題 | No.2880 Max Sigma Mod |
ユーザー |
|
提出日時 | 2024-09-08 13:26:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 3,000 ms |
コード長 | 409 bytes |
コンパイル時間 | 1,870 ms |
コンパイル使用メモリ | 195,780 KB |
最終ジャッジ日時 | 2025-02-24 05:31:03 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 48 |
ソースコード
#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;vector<ll> AN(N+1,0);for(ll i=1;i<=M;i++){for(ll j=i;j<=N;j+=i){AN[j]-=i;}}ll an=M+AN[1];for(ll x=2;x<=N;x++){AN[x]+=AN[x-1];an=max(an,x*M+AN[x]);}cout<<an<<endl;}