結果

問題 No.1431 東大文系数学2020第2問改
ユーザー 👑 NachiaNachia
提出日時 2021-03-14 14:43:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 4,027 ms
コンパイル使用メモリ 255,248 KB
実行使用メモリ 109,256 KB
最終ジャッジ日時 2024-04-23 22:25:43
合計ジャッジ時間 13,651 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
109,120 KB
testcase_01 WA -
testcase_02 AC 53 ms
109,124 KB
testcase_03 WA -
testcase_04 AC 40 ms
108,988 KB
testcase_05 WA -
testcase_06 AC 268 ms
108,996 KB
testcase_07 AC 269 ms
108,996 KB
testcase_08 WA -
testcase_09 AC 693 ms
109,116 KB
testcase_10 WA -
testcase_11 AC 279 ms
109,120 KB
testcase_12 AC 452 ms
108,996 KB
testcase_13 WA -
testcase_14 AC 340 ms
109,120 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 278 ms
108,996 KB
testcase_18 AC 275 ms
109,124 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 709 ms
108,992 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 58 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);
    if((X+Y-K)%2==0) ans += t;
    else ans-=t;
  }
  cout<<ans.val()<<endl;
  return 0;
}
0