結果

問題 No.1431 東大文系数学2020第2問改
ユーザー 👑 NachiaNachia
提出日時 2021-03-14 14:50:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 644 ms / 5,000 ms
コード長 759 bytes
コンパイル時間 3,761 ms
コンパイル使用メモリ 256,176 KB
実行使用メモリ 109,248 KB
最終ジャッジ日時 2024-04-23 22:31:26
合計ジャッジ時間 11,766 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
108,996 KB
testcase_01 AC 27 ms
109,116 KB
testcase_02 AC 28 ms
108,996 KB
testcase_03 AC 345 ms
109,120 KB
testcase_04 AC 27 ms
109,124 KB
testcase_05 AC 336 ms
109,124 KB
testcase_06 AC 225 ms
109,120 KB
testcase_07 AC 204 ms
109,124 KB
testcase_08 AC 242 ms
108,996 KB
testcase_09 AC 623 ms
109,248 KB
testcase_10 AC 290 ms
108,992 KB
testcase_11 AC 205 ms
109,120 KB
testcase_12 AC 373 ms
109,124 KB
testcase_13 AC 262 ms
109,000 KB
testcase_14 AC 277 ms
109,120 KB
testcase_15 AC 266 ms
108,992 KB
testcase_16 AC 232 ms
109,248 KB
testcase_17 AC 219 ms
109,124 KB
testcase_18 AC 210 ms
109,120 KB
testcase_19 AC 644 ms
109,128 KB
testcase_20 AC 224 ms
109,120 KB
testcase_21 AC 448 ms
109,120 KB
testcase_22 AC 151 ms
109,248 KB
testcase_23 AC 611 ms
108,988 KB
testcase_24 AC 632 ms
109,124 KB
testcase_25 AC 28 ms
109,124 KB
testcase_26 AC 28 ms
108,996 KB
testcase_27 AC 27 ms
109,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
using mll = atcoder::static_modint<998244353>;
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N,M,K;
const int Z=9000000;
mll F[Z+1];
mll I[Z+1];
mll iF[Z+1];

mll C(int n,int r){ if(n<r) return 0; return F[n]*iF[r]*iF[n-r]; }

int main(){
  cin>>N>>M>>K;
  mll ans=0;
  F[0]=I[1]=iF[0]=1;
  for(int i=1; i<=N*N; i++) F[i]=F[i-1]*i;
  for(int i=2; i<=N*N; i++) I[i]=-(998244353/i*I[998244353%i]);
  for(int i=1; i<=N*N; i++) iF[i]=iF[i-1]*I[i];
  rep(X,N+1) rep(Y,N+1){
    if(X+Y<K) continue;
    mll t = C((N-X)*(N-Y),M) * C(N,X) * C(N,Y) * C(X+Y,K);
    if((X+Y-K)%2==0) ans += t; else ans-=t;
  }
  cout<<ans.val()<<endl;
  return 0;
}
0