結果

問題 No.1310 量子アニーリング
ユーザー ytftytft
提出日時 2021-05-24 01:57:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 881 bytes
コンパイル時間 3,161 ms
コンパイル使用メモリ 343,956 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 11:13:55
合計ジャッジ時間 7,328 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int mp;

int main(){
    int N;
    cin>>N;
    int mod=998244353;
    vector<long long> C(N+1),co(N+1);
    C[0]=1;
    for(int i=1;i<N+1;i++){
        C[i]=(C[i-1]*(N-i+1))%mod;
        int temp=mod-2;
        long long ans=1;
        long long count=i;
        while(temp){
            if(temp%2){
                ans=(ans*count)%mod;
            }
            count=(count*count)%mod;
            temp>>=1;
        }
        C[i]=(C[i]*ans)%mod;
    }
    int temp=N%2+1;
    for(int i=N/2;i>=0;i--){
        co[i]=temp;
        co[N-i]=temp;
        temp=(temp*4)%mod;
    }
    long long ans=0;
    for(int i=0;i<N+1;i++){
        ans=(ans+C[i]*co[i])%mod;
    }
    
    for(int i=0;i<N+1;i++){
        cerr<<co[i]<<' ';
    }
    cout<<ans<<endl;
}
0