結果

問題 No.2406 Difference of Coordinate Squared
ユーザー momoyuumomoyuu
提出日時 2023-10-23 13:07:11
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,307 bytes
コンパイル時間 1,435 ms
コンパイル使用メモリ 112,968 KB
実行使用メモリ 19,372 KB
最終ジャッジ日時 2023-10-23 13:07:42
合計ジャッジ時間 28,354 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 284 ms
19,256 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 WA -
testcase_04 RE -
testcase_05 RE -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 281 ms
19,260 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 279 ms
19,256 KB
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 WA -
testcase_17 RE -
testcase_18 WA -
testcase_19 AC 289 ms
19,260 KB
testcase_20 WA -
testcase_21 RE -
testcase_22 WA -
testcase_23 WA -
testcase_24 RE -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 276 ms
19,256 KB
testcase_29 RE -
testcase_30 AC 302 ms
19,256 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 WA -
testcase_34 RE -
testcase_35 WA -
testcase_36 WA -
testcase_37 RE -
testcase_38 AC 279 ms
19,256 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 276 ms
19,256 KB
testcase_42 WA -
testcase_43 RE -
testcase_44 AC 279 ms
19,256 KB
testcase_45 RE -
testcase_46 WA -
testcase_47 RE -
testcase_48 WA -
testcase_49 RE -
testcase_50 AC 294 ms
19,260 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 278 ms
19,260 KB
testcase_56 AC 277 ms
19,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<stack>
#include<vector>
#include<set>

using namespace std;
using ll = long long;

#include<atcoder/modint>
using mint = atcoder::modint998244353;


const int mx = 2e6 + 10;
mint fac[mx],ifac[mx];
mint comb(int n,int r){
    return fac[n] * ifac[r] * ifac[n-r];
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    ll n,m;
    cin>>n>>m;
    fac[0] = 1;
    for(int i = 1;i<mx;i++) fac[i] = fac[i-1] * i;
    for(int i = 0;i<mx;i++) ifac[i] = fac[i].inv();

    mint ans = 0;
    vector<pair<ll,ll>> use;
    for(ll i = 1;i*i<=m;i++){
        if(m%i!=0) continue;
        ll a = i;
        ll b = m / i;
        use.push_back(make_pair(a,b));
        use.push_back(make_pair(-a,-b));
        if(abs(a)!=abs(b)){
            swap(a,b);
            use.push_back(make_pair(a,b));
            use.push_back(make_pair(-a,-b));
        }
    }
    for(int i = 0;i<use.size();i++){
        auto now = use[i];
        ll a = now.first;
        ll b = now.second;
        a = abs(a);
        b = abs(b);
        ll all = n;
        if(n%2!=a%2) continue;
        if(n%2!=b%2) continue;
        ll x = (a+n) / 2;
        ll y = (b+n) / 2;
        ans += comb(n,x) * comb(n,y);
    }
    ans /= mint(4).pow(n);
    cout<<ans.val()<<endl;
    
}


0