結果
問題 | No.1886 Sum of Slide Max |
ユーザー | auaua |
提出日時 | 2022-03-25 22:35:23 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 1,815 bytes |
コンパイル時間 | 1,669 ms |
コンパイル使用メモリ | 167,536 KB |
実行使用メモリ | 9,472 KB |
最終ジャッジ日時 | 2024-04-22 07:17:51 |
合計ジャッジ時間 | 3,612 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 46 ms
8,416 KB |
testcase_01 | AC | 46 ms
8,320 KB |
testcase_02 | AC | 48 ms
8,028 KB |
testcase_03 | AC | 46 ms
8,284 KB |
testcase_04 | AC | 46 ms
8,156 KB |
testcase_05 | AC | 62 ms
9,440 KB |
testcase_06 | AC | 46 ms
8,320 KB |
testcase_07 | AC | 57 ms
9,180 KB |
testcase_08 | AC | 61 ms
9,472 KB |
testcase_09 | AC | 61 ms
9,436 KB |
testcase_10 | AC | 61 ms
9,472 KB |
testcase_11 | AC | 62 ms
9,312 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; #include <unordered_set> #include <random> #define int long long #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define endl '\n' //#define vec vector<ll> //#define mat vector<vector<ll> > #define fi first #define se second #define double long double typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> pll; //typedef long double ld; typedef complex<double> Complex; const ll INF=1e9+7; const ll MOD=998244353; const ll inf=INF*INF; const ll mod=MOD; const ll MAX=200010; const double PI=acos(-1.0); typedef vector<vector<ll> > mat; typedef vector<ll> vec; //Combination long long extGCD(long long a,long long mod,long long &x,long long &y){ if(mod==0){ x=1; y=0; return a; } long long d=extGCD(mod,a%mod,y,x); y-=(a/mod)*x; return d; } long long invmod(long long a,long long mod){ long long x,y; extGCD(a,mod,x,y); x%=mod; if(x<0)x+=mod; return x; } ll fac[MAX],finv[MAX],inv[MAX]; void combinit(){ fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; REP(i,2,MAX){ fac[i]=fac[i-1]*i%mod; inv[i]=invmod(i,mod); finv[i]=finv[i-1]*inv[i]%mod; } } ll comb(ll n,ll k){ if(n<k)return 0; if(n<0||k<0)return 0; return fac[n]*(finv[k]*finv[n-k]%mod)%mod; } void solve(){ combinit(); ll n;cin>>n; vector<ll>kai(n+1); kai[0]=1; REP(i,1,n+1)kai[i]=kai[i-1]*i%mod; REP(i,1,n+1){ ll ans=i*kai[i]%mod*kai[n-i+1]%mod*comb(n+1,i+1)%mod; if(ans<0)ans+=mod; cout<<ans<<endl; } } signed main(){ cin.tie(0); ios::sync_with_stdio(false); solve(); }