結果
問題 | No.2891 Mint |
ユーザー | kakao745 |
提出日時 | 2024-09-18 07:15:10 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,993 bytes |
コンパイル時間 | 3,294 ms |
コンパイル使用メモリ | 251,040 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-18 07:15:17 |
合計ジャッジ時間 | 5,569 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | WA | - |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 1 ms
6,940 KB |
testcase_38 | AC | 2 ms
6,940 KB |
testcase_39 | AC | 2 ms
6,944 KB |
testcase_40 | AC | 2 ms
6,940 KB |
testcase_41 | AC | 2 ms
6,940 KB |
testcase_42 | AC | 2 ms
6,940 KB |
testcase_43 | AC | 2 ms
6,944 KB |
testcase_44 | AC | 2 ms
6,940 KB |
testcase_45 | AC | 2 ms
6,940 KB |
testcase_46 | AC | 3 ms
6,944 KB |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
ソースコード
#include<bits/stdc++.h> using namespace std; #include<atcoder/modint> using namespace atcoder; using mint=modint998244353; #define itn int #define rep(i,n) for(long long i=0;i<(long long)n;i++) #define reps(i,n) for(long long i=1;i<=(long long)n;i++) #define loop(i,l,r) for(long long i=l;i<=(long long)r;i++) #define drep(i,n) for(long long i=(long long)n-1;i>=0;i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define yn(x) cout << (x? "Yes":"No") << endl; #define cou(x) cout << x << endl; #define emp emplace_back #pragma GCC target ("avx,avx2")//四則演算 #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops")//ループ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")//浮動小数点 const long long mod=998244353LL; const long long mods=1000000007LL; const double inf=numeric_limits<double>::infinity(); const int kaz=1000000000; const long long yab=2500000000000000000LL; const long long aho =-yab; const long double eps=1.0e-14L; const long double pi=acosl(-1.0L); using ll=long long; using st=string; using P=pair<ll,ll>; using tup=tuple<ll,ll,ll>; using vi=vector<ll>; using vin=vector<int>; using vc=vector<char>; using vb=vector<bool>; using vd=vector<double>; using vs=vector<string>; using vp=vector<P>; using sp=set<P>; using si=set<ll>; using vvi=vector<vector<ll>>; using vvin=vector<vin>; using vvc=vector<vc>; using vvb=vector<vb>; using vvvi=vector<vvi>; using vvvin=vector<vvin>; const int dx[4]={0,1,0,-1}; const int dy[4]={1,0,-1,0}; const vector<int> ex = {-1, -1, -1, 0, 0, 1, 1, 1}; const vector<int> ey = {-1, 0, 1, -1, 1, -1, 0, 1}; template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&in:v)is>>in;return is;} template<typename T>ostream&operator<<(ostream&os,vector<T>v){rep(i,v.size())os<<v[i]<<(i+1!=v.size()?" ":"\n");return os;} template<typename T1,typename T2> void co(bool x,T1 y,T2 z){ if(x)cout << y << endl; else cout << z << endl; } template<typename T> bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; } template<typename T> bool chmin(T &a, T b){ if(a>b){ a=b; return true; } return false; } template<typename T> void print(vector<T> &a){ for(int i=0;i<a.size();i++){ cout << a[i]; if(i==(long long)a.size()-1)cout << endl; else cout << " "; } } ll mypow(ll x,ll y){ ll ret=1; while(y>0){ if(y&1)ret=ret*x%mod; x=x*x%mod; y>>=1; } return ret; } ll nopow(ll x,ll y){ ll ret=1; while(y>0){ if(y&1)ret*=x; x*=x; y>>=1; } return ret; } int main(){ ll n,m; cin >> n >> m; if(m==1){ cout << (n-1)%mod << endl; return 0; } if(n==1){ cout << 0 << endl; return 0; } ll ok=m,ng=0; while(ok-ng>1){ ll mid=(ok+ng)/2; if(m/(mid*(mid+1))>=1)ng=mid; else ok=mid; } ll k=ng; mint res=0; loop(i,m/n,m/(k+1)){ if(i==m/n){ res+=(m%n+m%(m/(i+1)+1)*(n-m/(i+1)))/2; continue; } res+=(m%(m/i)+m%(m/(i+1)+1))*(m/i-m/(i+1))/2; } reps(i,k){res+=m%i;} cout << res.val() << endl; }