結果

問題 No.1655 123 Swaps
ユーザー chocoruskchocorusk
提出日時 2021-06-13 02:42:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 895 bytes
コンパイル時間 2,880 ms
コンパイル使用メモリ 155,780 KB
実行使用メモリ 15,152 KB
最終ジャッジ日時 2024-04-22 03:20:39
合計ジャッジ時間 6,787 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
15,152 KB
testcase_01 AC 3 ms
8,136 KB
testcase_02 WA -
testcase_03 AC 4 ms
8,256 KB
testcase_04 AC 3 ms
8,260 KB
testcase_05 AC 2 ms
8,216 KB
testcase_06 AC 2 ms
8,256 KB
testcase_07 AC 3 ms
8,388 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 4 ms
8,260 KB
testcase_14 AC 3 ms
8,136 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint=modint998244353;
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 i=0; i<=a; i++){
        int l=max(0, a+b-n/2-i);
        int r=((a-b+i)%3+3)%3;
        while(l%3!=r) l++;
        for(int j=l; j<=min(b, n/2-i); j+=3){
            ans+=f[n/2]*invf[i]*invf[j]*invf[n/2-i-j]*f[n/2]*invf[a-i]*invf[b-j]*invf[n/2-(a-i)-(b-j)];
        }
    }
    cout<<ans.val()<<endl;
    return 0;
}
0