結果

問題 No.2237 Xor Sum Hoge
ユーザー rabimearabimea
提出日時 2023-03-03 22:06:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 948 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 202,492 KB
実行使用メモリ 12,556 KB
最終ジャッジ日時 2023-10-18 02:12:15
合計ジャッジ時間 24,982 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
using ll = long long;
using vi = vector <int>;
const ll mod = 998244353;

const int N = 12e4 + 11;
ll inv[N], fac[N], ifac[N];
ll binom(int n, int m) {
	if(n < m || m < 0) return 0; // n >= 0
	return fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}

ll f[N], g[N];

int main() {
	inv[1] = fac[0] = ifac[0] = 1;
	for(int i = 2; i < N; i ++)
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	for(int i = 1; i < N; i ++) {
		fac[i] = i * fac[i - 1] % mod;
		ifac[i] = inv[i] * ifac[i - 1] % mod;
	}
	ios::sync_with_stdio(0);
	
	int n; ll b, c;
	cin >> n >> b >> c;

	f[0] = 1;
	while(b > 0) {
		fill(g, g + N, 0);
		for(int i = 0; i <= n; i ++)
			for(int j = (c & 1); j <= n; j += 2) {
				g[i + j] += f[i] * binom(n, j);
				g[i + j] %= mod;
			}
		
		fill(f, f + N, 0);
		for(int i = 0; i <= n; i ++)
			f[i] = g[i * 2 + (b & 1)];
		
		b /= 2;
		c /= 2;
	}
	
	cout << f[0] << '\n';
}
0