結果

問題 No.2406 Difference of Coordinate Squared
ユーザー 👑 獅子座じゃない人獅子座じゃない人
提出日時 2023-07-01 23:51:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,093 bytes
コンパイル時間 4,046 ms
コンパイル使用メモリ 231,648 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2023-10-19 00:15:18
合計ジャッジ時間 7,583 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 153 ms
11,128 KB
testcase_03 WA -
testcase_04 AC 152 ms
11,128 KB
testcase_05 AC 11 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 103 ms
8,624 KB
testcase_09 AC 106 ms
8,888 KB
testcase_10 AC 138 ms
10,668 KB
testcase_11 AC 123 ms
9,348 KB
testcase_12 AC 122 ms
9,880 KB
testcase_13 WA -
testcase_14 AC 131 ms
10,144 KB
testcase_15 AC 144 ms
10,864 KB
testcase_16 WA -
testcase_17 AC 2 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 135 ms
10,144 KB
testcase_20 WA -
testcase_21 AC 83 ms
7,568 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 36 ms
5,192 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 WA -
testcase_34 AC 2 ms
4,348 KB
testcase_35 WA -
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 2 ms
4,348 KB
testcase_42 WA -
testcase_43 AC 2 ms
4,348 KB
testcase_44 AC 2 ms
4,348 KB
testcase_45 AC 2 ms
4,348 KB
testcase_46 WA -
testcase_47 AC 2 ms
4,348 KB
testcase_48 WA -
testcase_49 AC 2 ms
4,348 KB
testcase_50 AC 2 ms
4,348 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 2 ms
4,348 KB
testcase_56 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353;

int main(void)
{
    long long n,m;
    cin >> n >> m;
    vector<mint> fact(n+1,1);
    vector<mint> fact_inv(n+1,1);
    for(int i=1;i<=n;++i){
        fact[i]=fact[i-1]*i;
        fact_inv[i]=fact_inv[i-1]/i;
    }
    mint ans=0;
    for(long long i=1;i*i<=m;++i){
        if(m%i){
            continue;
        }
        long long j=m/i;
        if((j+i)%2){
            continue;
        }
        long long x=(j+i)/2;
        long long y=(j-i)/2;
        if(x+y>n){
            continue;
        }
        if((n-x-y)%2){
            continue;
        }
        long long a=x+(n-x-y)/2;
        long long b=(n-x-y)/2;
        if(a>n){
            continue;
        }
        if(y){
            ans+=4*fact[n]*fact_inv[a]*fact_inv[n-a]*fact[n]*fact_inv[b]*fact_inv[n-b];
        } else {
            ans+=2*fact[n]*fact_inv[a]*fact_inv[n-a]*fact[n]*fact_inv[b]*fact_inv[n-b];
        }
    }
    ans/=mint(4).pow(n);
    cout << ans.val() << endl;
    return 0;
}
0