結果

問題 No.1655 123 Swaps
ユーザー chocoruskchocorusk
提出日時 2021-06-25 02:49:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 1,183 bytes
コンパイル時間 3,332 ms
コンパイル使用メモリ 161,792 KB
実行使用メモリ 15,304 KB
最終ジャッジ日時 2024-04-22 03:23:36
合計ジャッジ時間 6,781 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,340 KB
testcase_01 AC 4 ms
8,192 KB
testcase_02 AC 4 ms
8,192 KB
testcase_03 AC 4 ms
8,192 KB
testcase_04 AC 5 ms
8,136 KB
testcase_05 AC 4 ms
8,388 KB
testcase_06 AC 3 ms
8,136 KB
testcase_07 AC 4 ms
8,320 KB
testcase_08 AC 4 ms
8,192 KB
testcase_09 AC 4 ms
8,384 KB
testcase_10 AC 3 ms
8,260 KB
testcase_11 AC 4 ms
8,320 KB
testcase_12 AC 4 ms
8,320 KB
testcase_13 AC 4 ms
8,260 KB
testcase_14 AC 4 ms
8,260 KB
testcase_15 AC 118 ms
15,000 KB
testcase_16 AC 116 ms
15,000 KB
testcase_17 AC 115 ms
15,136 KB
testcase_18 AC 113 ms
15,020 KB
testcase_19 AC 114 ms
15,148 KB
testcase_20 AC 118 ms
15,132 KB
testcase_21 AC 115 ms
15,132 KB
testcase_22 AC 113 ms
15,156 KB
testcase_23 AC 115 ms
15,304 KB
testcase_24 AC 114 ms
15,284 KB
testcase_25 AC 115 ms
15,180 KB
testcase_26 AC 110 ms
14,872 KB
testcase_27 AC 62 ms
11,928 KB
testcase_28 AC 59 ms
11,420 KB
testcase_29 AC 110 ms
14,364 KB
testcase_30 AC 112 ms
14,148 KB
testcase_31 AC 58 ms
11,648 KB
testcase_32 AC 4 ms
8,264 KB
testcase_33 AC 4 ms
8,256 KB
testcase_34 AC 5 ms
8,192 KB
testcase_35 AC 6 ms
8,260 KB
testcase_36 AC 11 ms
9,408 KB
testcase_37 AC 11 ms
9,496 KB
testcase_38 AC 14 ms
9,620 KB
testcase_39 AC 16 ms
9,624 KB
testcase_40 AC 112 ms
15,004 KB
testcase_41 AC 4 ms
8,192 KB
testcase_42 AC 4 ms
8,384 KB
testcase_43 AC 3 ms
8,320 KB
testcase_44 AC 4 ms
8,212 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 ans=0;
    for(int p=0; p<3; p++){
        for(int q=0; q<3; q++){
            if((p+b-q+3)%3!=(a-p+q+3)%3) continue;
            vector<mint> vp(a+1), vq(b+1);
            for(int i=p; i<=a; i+=3){
                vp[i]=f[n/2]*invf[i]*invf[a-i];
            }
            for(int i=q; i<=b; i+=3){
                vq[i]=f[n/2]*invf[i]*invf[b-i];
            }
            auto v=convolution(vp, vq);
            for(int i=max(0, a+b-n/2); i<=n/2 && i<v.size(); i++){
                ans+=v[i]*invf[n/2-i]*invf[n/2-a-b+i];
            }
        }
    }
    cout<<ans.val()<<endl;
    return 0;
}
0