結果
問題 |
No.2880 Max Sigma Mod
|
ユーザー |
![]() |
提出日時 | 2024-09-08 13:52:58 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 946 bytes |
コンパイル時間 | 5,919 ms |
コンパイル使用メモリ | 311,008 KB |
実行使用メモリ | 11,088 KB |
最終ジャッジ日時 | 2024-09-08 13:53:24 |
合計ジャッジ時間 | 24,015 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 45 WA * 3 |
ソースコード
#include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint=modint998244353;//modint1000000007 #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template <class T> using V=vector<T>; template <class T> using VV=V<V<T>>; //B(n,V<int>(n)) ll op(ll l, ll r) { return max(l,r); } ll e() { return 0; } ll mapping(ll l, ll r) { return l+r; } ll composition(ll l, ll r) { return l+r; } ll id() { return 0; } int main() { int n,m; cin>>n>>m; lazy_segtree<ll, op, e, ll, mapping, composition, id> seg(n+1); for(int i=2;i<=m;i++){ for(int j=i-1;j<=n;j+=i) seg.apply(j,j+1,-i+1); for(int k=0;i*k<n+1;k++) seg.apply(i*k,min(i*k+i-1,n+1),1); } V<ll> A(n); rep(i,n) A[i]=seg.get(i); ll ma=A[1]; for(int i=1;i<n;i++){ A[i]+=A[i-1]; ma=max(ma,A[i]); } cout<<ma<<endl; return 0; }