結果

問題 No.1310 量子アニーリング
ユーザー tempura_pptempura_pp
提出日時 2020-12-07 03:59:49
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,497 bytes
コンパイル時間 1,176 ms
コンパイル使用メモリ 122,040 KB
実行使用メモリ 32,332 KB
最終ジャッジ日時 2023-10-17 15:54:55
合計ジャッジ時間 3,222 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
32,244 KB
testcase_01 AC 44 ms
32,244 KB
testcase_02 AC 43 ms
32,244 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 44 ms
32,244 KB
testcase_06 WA -
testcase_07 AC 43 ms
32,244 KB
testcase_08 AC 43 ms
32,244 KB
testcase_09 AC 43 ms
32,244 KB
testcase_10 WA -
testcase_11 AC 43 ms
32,244 KB
testcase_12 AC 43 ms
32,244 KB
testcase_13 AC 47 ms
32,244 KB
testcase_14 AC 50 ms
32,244 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 58 ms
32,244 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 45 ms
32,244 KB
testcase_21 AC 44 ms
32,244 KB
testcase_22 AC 61 ms
32,244 KB
testcase_23 AC 47 ms
32,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=998244353 ;


vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    rep(i,n){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll perm(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
    k%=mod-1;
    if(k<0)k+=mod-1;
    ll ret=1;
    while(k){
        if(k&1)ret=ret*n%mod;
        n=n*n%mod;
        k>>=1;
    }
    return ret;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    mod_build(1234567);
    ll ans = 0;
    ll cur = n;
    rep(i,n+1){
        ans += comb(n, i) * powmod(2, abs(cur)) % mod;
        cur -= 2;
    }
    cout << ans % mod << endl;
    return 0;
}
0