結果
| 問題 | No.2237 Xor Sum Hoge |
| コンテスト | |
| ユーザー |
👑 potato167
|
| 提出日時 | 2023-03-02 18:17:59 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,738 bytes |
| 記録 | |
| コンパイル時間 | 1,999 ms |
| コンパイル使用メモリ | 204,852 KB |
| 最終ジャッジ日時 | 2025-02-11 01:13:11 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 TLE * 17 |
ソースコード
#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++)
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};
auto convolution=[&](vector<ll> l,vector<ll> r)->vector<ll>{
int n=l.size(),m=r.size();
vector<ll> res(n+m-1);
rep(i,0,n) rep(j,0,m){
res[i+j]=(res[i+j]+l[i]*r[j])%mod;
}
return res;
};
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";
}
potato167