結果

問題 No.1655 123 Swaps
ユーザー chocoruskchocorusk
提出日時 2021-06-25 02:49:09
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 1,153 bytes
コンパイル時間 3,496 ms
コンパイル使用メモリ 163,292 KB
実行使用メモリ 14,540 KB
最終ジャッジ日時 2024-04-22 03:23:29
合計ジャッジ時間 5,719 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,260 KB
testcase_01 AC 5 ms
8,192 KB
testcase_02 AC 4 ms
8,264 KB
testcase_03 AC 4 ms
8,260 KB
testcase_04 AC 5 ms
8,320 KB
testcase_05 AC 4 ms
8,260 KB
testcase_06 AC 4 ms
8,192 KB
testcase_07 AC 4 ms
8,392 KB
testcase_08 AC 3 ms
8,192 KB
testcase_09 AC 5 ms
8,192 KB
testcase_10 AC 3 ms
8,320 KB
testcase_11 AC 3 ms
8,260 KB
testcase_12 AC 4 ms
8,320 KB
testcase_13 AC 3 ms
8,320 KB
testcase_14 AC 4 ms
8,320 KB
testcase_15 AC 51 ms
14,340 KB
testcase_16 AC 50 ms
14,440 KB
testcase_17 AC 52 ms
14,372 KB
testcase_18 AC 50 ms
14,492 KB
testcase_19 AC 52 ms
14,516 KB
testcase_20 AC 51 ms
14,348 KB
testcase_21 AC 51 ms
14,200 KB
testcase_22 AC 52 ms
14,280 KB
testcase_23 AC 52 ms
14,416 KB
testcase_24 AC 52 ms
14,416 KB
testcase_25 AC 53 ms
14,540 KB
testcase_26 AC 51 ms
14,240 KB
testcase_27 AC 28 ms
11,768 KB
testcase_28 AC 27 ms
10,920 KB
testcase_29 AC 47 ms
13,460 KB
testcase_30 AC 46 ms
13,912 KB
testcase_31 AC 28 ms
11,592 KB
testcase_32 AC 5 ms
8,320 KB
testcase_33 AC 3 ms
8,192 KB
testcase_34 AC 4 ms
8,128 KB
testcase_35 AC 6 ms
8,192 KB
testcase_36 AC 9 ms
9,344 KB
testcase_37 AC 9 ms
9,472 KB
testcase_38 AC 12 ms
9,412 KB
testcase_39 AC 13 ms
9,472 KB
testcase_40 AC 49 ms
14,308 KB
testcase_41 AC 4 ms
8,264 KB
testcase_42 AC 3 ms
8,260 KB
testcase_43 AC 4 ms
8,392 KB
testcase_44 AC 4 ms
8,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
const int MOD=924844033;
using mint=static_modint<MOD>;
mint f[600060], invf[600060];
void fac(int n){
    f[0]=1;
    for(int i=1; i<=n; i++) f[i]=f[i-1]*i;
    invf[n]=f[n].inv();
    for(int 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 a, b, c;
    cin>>a>>b>>c;
	int n=a+b+c;
    if(n%2!=0){
        cout<<0<<endl;
        return 0;
    }
    fac(n);
    mint w=mint(5).pow((MOD-1)/3), winv=w.inv();
    mint s1=f[n]*invf[a]*invf[b]*invf[c], s2=0;
    vector<mint> vp(a+1), vq(b+1);
    mint wp=winv.pow(a);
    for(int i=0; i<=a; i++){
        vp[i]=f[n/2]*invf[i]*invf[a-i]*wp;
        wp*=winv;
    }
    wp=w.pow(b);
    for(int i=0; i<=b; i++){
        vq[i]=f[n/2]*invf[i]*invf[b-i]*wp;
        wp*=w;
    }
    auto v=convolution(vp, vq);
    for(int i=max(0, a+b-n/2); i<=n/2 && i<v.size(); i++){
        s2+=v[i]*invf[n/2-i]*invf[n/2-a-b+i];
    }
    mint ans=(s1+2*s2)/3;
    cout<<ans.val()<<endl;
    return 0;
}
0