結果

問題 No.2485 Add to Variables (Another)
ユーザー MagentorMagentor
提出日時 2023-09-22 20:05:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,141 bytes
コンパイル時間 4,120 ms
コンパイル使用メモリ 260,372 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2023-09-22 20:50:28
合計ジャッジ時間 5,895 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
7,700 KB
testcase_01 AC 7 ms
7,572 KB
testcase_02 AC 7 ms
7,700 KB
testcase_03 AC 7 ms
7,732 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 7 ms
7,804 KB
testcase_12 WA -
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 AC 7 ms
7,716 KB
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 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
const int MOD = 998244353;
vector<long long> fact, fact_inv, inv;
void nCk_calc(int s) {
    fact.resize(s + 2);
    fact_inv.resize(s + 2);
    inv.resize(s + 2);
    fact[0] = 1;
    fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < s + 2; i++) {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int n, int k) {
	if(n<k || n<0 || k<0){ return 0; }
    return fact[n] * (fact_inv[k] * fact_inv[n - k] % MOD) % MOD;
}
int main() {
nCk_calc(200005);
 int n,m;cin>>n>>m;
 int a,b,c,d;cin>>a>>b>>c>>d;
 mint ans = 0;
 for(int i = 0;i <= min(d,b);i++){
   mint res = 1;
   res *= nCk(m,d);
   res *= nCk(d,i);
   res *= nCk(m-d,b-i);
   res *= nCk(m-(b-i)-(d-i),a-(b-i));
   res *= nCk(m-i-((m-d)-(b-i)),c-i);
   ans += res;
 }
 cout << ans.val() << endl;return 0;
}
0