結果

問題 No.1431 東大文系数学2020第2問改
ユーザー chocoruskchocorusk
提出日時 2021-03-15 12:58:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 939 ms / 5,000 ms
コード長 1,492 bytes
コンパイル時間 4,559 ms
コンパイル使用メモリ 187,080 KB
実行使用メモリ 73,984 KB
最終ジャッジ日時 2024-04-24 16:43:49
合計ジャッジ時間 17,053 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
73,856 KB
testcase_01 AC 53 ms
73,856 KB
testcase_02 AC 52 ms
73,984 KB
testcase_03 AC 696 ms
73,856 KB
testcase_04 AC 53 ms
73,728 KB
testcase_05 AC 875 ms
73,856 KB
testcase_06 AC 854 ms
73,728 KB
testcase_07 AC 844 ms
73,728 KB
testcase_08 AC 840 ms
73,856 KB
testcase_09 AC 911 ms
73,984 KB
testcase_10 AC 519 ms
73,856 KB
testcase_11 AC 528 ms
73,856 KB
testcase_12 AC 508 ms
73,856 KB
testcase_13 AC 308 ms
73,728 KB
testcase_14 AC 314 ms
73,856 KB
testcase_15 AC 288 ms
73,856 KB
testcase_16 AC 236 ms
73,728 KB
testcase_17 AC 216 ms
73,856 KB
testcase_18 AC 215 ms
73,728 KB
testcase_19 AC 901 ms
73,856 KB
testcase_20 AC 220 ms
73,856 KB
testcase_21 AC 676 ms
73,728 KB
testcase_22 AC 327 ms
73,856 KB
testcase_23 AC 939 ms
73,728 KB
testcase_24 AC 917 ms
73,856 KB
testcase_25 AC 53 ms
73,856 KB
testcase_26 AC 54 ms
73,856 KB
testcase_27 AC 52 ms
73,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
using mint=modint998244353;
mint f[9000090], invf[9000090];
void fac(int n){
    f[0]=1;
    for(ll i=1; i<=n; i++) f[i]=f[i-1]*i;
    invf[n]=f[n].inv();
    for(ll i=n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1);
}
mint comb(int x, int y){
    if(!(0<=y && y<=x)) return 0;
    return f[x]*invf[y]*invf[x-y];
}
int main()
{
    int n, m, k;
    cin>>n>>m>>k;
    fac(max(n*n, 2*n));
    mint ans=0;
    for(int a=0; a<=n; a++){
        for(int b=0; b<=n; b++){
            // for(int z=0; z<=n; z++){
            //     mint w=comb(a*b, m)*comb(n-z, a)*comb(n-k+z, b)*comb(n, z)*comb(n, k-z);
            //     if((k+a+b)&1) ans-=w;
            //     else ans+=w;
            // }
            mint z=comb(a*b, m)*f[n]*f[n]*invf[a]*invf[b]*invf[n-a]*invf[n-b]*comb(2*n-a-b, k);
            if((k+a+b)&1) ans-=z;
            else ans+=z;
        }
    }
    cout<<ans.val()<<endl;
    return 0;
}
0