結果
問題 | No.2880 Max Sigma Mod |
ユーザー |
![]() |
提出日時 | 2024-09-20 01:24:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2,587 ms / 3,000 ms |
コード長 | 615 bytes |
コンパイル時間 | 1,870 ms |
コンパイル使用メモリ | 192,496 KB |
最終ジャッジ日時 | 2025-02-24 09:40:40 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 48 |
コンパイルメッセージ
main.cpp:6:12: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’ 6 | bool chmin(auto &a, auto b){ return a > b ? a = b, 1 : 0; } | ^~~~ main.cpp:6:21: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’ 6 | bool chmin(auto &a, auto b){ return a > b ? a = b, 1 : 0; } | ^~~~ main.cpp:7:12: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’ 7 | bool chmax(auto &a, auto b){ return a < b ? a = b, 1 : 0; } | ^~~~ main.cpp:7:21: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’ 7 | bool chmax(auto &a, auto b){ return a < b ? a = b, 1 : 0; } | ^~~~
ソースコード
#include<bits/stdc++.h> #define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++) #define all(v) begin(v),end(v) using namespace std; using ll = long long; bool chmin(auto &a, auto b){ return a > b ? a = b, 1 : 0; } bool chmax(auto &a, auto b){ return a < b ? a = b, 1 : 0; } int main(){ cin.tie(0)->sync_with_stdio(0); int n, m; cin >> n >> m; ll ans = 0; for (int i=1;i<=n;i++){ ll tmp = (ll)m*i; int x=i; while(x>0){ int v=i/x; int y=i/(v+1); int l=min(m,y)+1; int r=min(m,x)+1; tmp -= (ll)v*((ll)r*(r-1)/2-(ll)l*(l-1)/2); x=y; } chmax(ans,tmp); } cout << ans << '\n'; }