結果

問題 No.2141 Enumeratest
ユーザー umezoumezo
提出日時 2022-12-02 22:44:36
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 812 bytes
コンパイル時間 2,575 ms
コンパイル使用メモリ 196,784 KB
実行使用メモリ 57,960 KB
最終ジャッジ日時 2024-04-18 07:45:41
合計ジャッジ時間 5,331 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
50,320 KB
testcase_01 AC 48 ms
50,464 KB
testcase_02 AC 51 ms
50,428 KB
testcase_03 AC 58 ms
50,400 KB
testcase_04 AC 66 ms
57,960 KB
testcase_05 AC 60 ms
57,856 KB
testcase_06 AC 47 ms
50,304 KB
testcase_07 AC 48 ms
50,356 KB
testcase_08 AC 49 ms
50,264 KB
testcase_09 AC 50 ms
50,404 KB
testcase_10 AC 52 ms
50,432 KB
testcase_11 AC 60 ms
50,416 KB
testcase_12 AC 49 ms
50,348 KB
testcase_13 AC 51 ms
50,392 KB
testcase_14 AC 57 ms
50,320 KB
testcase_15 AC 55 ms
50,472 KB
testcase_16 AC 52 ms
50,452 KB
testcase_17 AC 61 ms
55,100 KB
testcase_18 AC 58 ms
56,508 KB
testcase_19 AC 64 ms
56,932 KB
testcase_20 AC 61 ms
55,676 KB
testcase_21 AC 59 ms
56,340 KB
testcase_22 AC 55 ms
54,528 KB
testcase_23 AC 54 ms
52,252 KB
testcase_24 AC 62 ms
51,652 KB
testcase_25 AC 56 ms
50,420 KB
testcase_26 AC 65 ms
57,056 KB
testcase_27 AC 66 ms
56,064 KB
testcase_28 AC 61 ms
57,616 KB
testcase_29 AC 57 ms
54,016 KB
testcase_30 AC 65 ms
57,088 KB
testcase_31 AC 59 ms
54,796 KB
testcase_32 AC 65 ms
55,552 KB
testcase_33 AC 62 ms
54,764 KB
testcase_34 AC 61 ms
54,400 KB
testcase_35 AC 47 ms
50,584 KB
testcase_36 AC 64 ms
57,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MOD=998244353;
const int MAX=2000200;
ll fac[MAX],finv[MAX],inv[MAX];

void init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<MAX;i++){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}

ll nCr(int n,int k){
  if(n<k) return 0;
  if(n<0 || k<0) return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  init();
  
  ll n,m;
  cin>>n>>m;
  
  vector<ll> A(n);
  rep(i,m) A[i%n]++;
  
  ll ans=1,res=m;
  rep(i,n){
    ans=ans*nCr(res,A[i])%MOD;
    res-=A[i];
  }
  cout<<ans<<endl;
  
  return 0;
}
0