結果

問題 No.2237 Xor Sum Hoge
ユーザー 👑 potato167potato167
提出日時 2023-02-21 16:29:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 264 ms / 10,000 ms
コード長 1,584 bytes
コンパイル時間 4,934 ms
コンパイル使用メモリ 279,656 KB
実行使用メモリ 7,556 KB
最終ジャッジ日時 2023-09-29 14:15:49
合計ジャッジ時間 11,024 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 261 ms
7,556 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 57 ms
4,376 KB
testcase_12 AC 125 ms
5,148 KB
testcase_13 AC 222 ms
7,104 KB
testcase_14 AC 127 ms
5,284 KB
testcase_15 AC 60 ms
4,420 KB
testcase_16 AC 249 ms
6,236 KB
testcase_17 AC 242 ms
5,960 KB
testcase_18 AC 120 ms
4,700 KB
testcase_19 AC 115 ms
4,624 KB
testcase_20 AC 244 ms
5,772 KB
testcase_21 AC 260 ms
7,124 KB
testcase_22 AC 258 ms
6,952 KB
testcase_23 AC 264 ms
7,352 KB
testcase_24 AC 262 ms
7,224 KB
testcase_25 AC 258 ms
7,084 KB
testcase_26 AC 261 ms
7,148 KB
testcase_27 AC 259 ms
7,280 KB
testcase_28 AC 256 ms
7,168 KB
testcase_29 AC 256 ms
7,084 KB
testcase_30 AC 264 ms
7,456 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 5 ms
4,376 KB
testcase_34 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll=long long;
const int mod=998244353;
#define rep(i,a,b) for (ll i=a;i<b;i++)
#include<atcoder/all>
using namespace atcoder;

namespace po167{
struct combination{
	int upper;
	long long MOD;
	std::vector<long long> fact;
	std::vector<long long> rev;
	std::vector<long long> fact_rev;
	combination(int max,long long mod):upper(max),MOD(mod),fact(max+1),rev(max+1),fact_rev(max+1){
		for(long long i=0;i<=max;i++){
			if(i<2){
				fact[i]=1;
				fact_rev[i]=1;
				rev[i]=1;
				continue;
			}
			fact[i]=(fact[i-1]*i)%mod;
			rev[i]=mod-((mod/i)*rev[mod%i])%mod;
			fact_rev[i]=(fact_rev[i-1]*rev[i])%mod;
		}
	}
	long long Comb(int x,int y){
		assert(upper>=x);
		if (x<y||y<0||x<0) return 0;
		return (((fact_rev[y]*fact_rev[x-y])%MOD)*fact[x])%MOD;
	}
	long long P(int x,int y){
		assert(upper>=x);
		if (x<y||y<0||x<0) return 0;
		return (fact_rev[x-y]*fact[x])%MOD;
	}
};
}
using po167::combination;



void solve();
// oddloop
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int t=1;
	//cin>>t;
	rep(i,0,t) solve();
}

void solve(){
	int N;
	ll B,C;
	cin>>N>>B>>C;
	combination table(N,mod);
	vector<vector<ll>> f(2);
	rep(i,0,N+1) f[i&1].push_back(table.Comb(N,i));
	vector<ll> ans={1};
	rep(d,0,63){
        int ind=(B&1)-(C&1);
		vector<ll> n_ans;
		while(ind<(int)(ans.size())){
            if(ind<0) n_ans.push_back(0);
            else n_ans.push_back(ans[ind]);
            ind+=2;
        }
        ans=convolution(n_ans,f[C&1]);
		B>>=1,C>>=1;
	}
	cout<<ans[0]<<"\n";
}
0