結果

問題 No.3515 Anti EIKO
コンテスト
ユーザー Yoyoyo8128
提出日時 2026-04-16 09:50:05
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
RE  
実行時間 -
コード長 3,195 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,657 ms
コンパイル使用メモリ 229,388 KB
実行使用メモリ 7,968 KB
最終ジャッジ日時 2026-04-24 20:54:05
合計ジャッジ時間 14,894 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#pragma region Yoyoyo

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using i128t=__int128_t;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const string Yes="Yes";
const string No="No";
const long long inf=1ll<<60;

#ifndef LOCAL
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define faster ios::sync_with_stdio(false);cin.tie(nullptr);
#define print(s) cout<<s<<endl;

template<typename T>
inline bool chmax(T &a,T b){return ((a<b)?(a=b,true):(false));}
template<typename T>
inline bool chmin(T &a,T b){return ((a>b)?(a=b,true):(false));}
template<typename T>
ll sum(const T&a){return accumulate(all(a),0LL);}

template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U>&p){
    os<<p.first<<" "<<p.second;
    return os;
}

template<typename T,typename U>
istream &operator>>(istream &is,pair<T,U>&p){
    is>>p.first>>p.second;
    return is;
}

template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    int s=v.size();
    for(int i=0;i<s;i++){
        os<<(i?" ":"")<<v[i];
    }
    return os;
}

template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(auto &x:v){
        is>>x;
    }
    return is;
}

template<typename T>
ostream &operator<<(ostream &os,const vector<vector<T>>&v){
    int s=v.size();
    for(int i=0;i<s;i++){
        os<<v[i]<<endl;
    }
    return os;
}

template<typename T>
ostream &operator<<(ostream &os,const vector<vector<vector<T>>>&v){
    int s=v.size();
    for(int i=0;i<s;i++){
        os<<"i = "<<i<<endl;
        os<<v[i];
    }
    return os;
}

#ifdef LOCAL
template<class... Args>
void debug_out(Args... args){
    int _i=0;
    ((cerr<<(_i++?", ":" ")<<args), ...);
    cerr<<"\n";
}
#define debug(...){\
    cerr<<"["<<#__VA_ARGS__<<"]:";\
    debug_out(__VA_ARGS__);\
}
#else
#define debug(...)
#endif

#pragma endregion Yoyoyo


ll mod=998244353;


int main(){
    faster;
    ll N,K;
    cin>>N>>K;
    vector M(4*N+1,vector<ll>(4*N+1));
    ll d5=598946612;//1/5
    for(int i=0;i<4*N;i++){
        if(i%4==0){
            M[i][i+1]=d5;
            M[i][0]=(d5*4)%mod;
        }else{
            M[i][i+1]=d5;
            M[i][0]=(d5*3)%mod;
            M[i][1]=d5;
        }
    }
    auto matrix_multi = [](vector<vector<ll>>&A,const vector<vector<ll>>M)->void {
        int sz=A.size();
        vector ans(sz,vector<ll>(sz));
        for(int i=0;i<sz;i++){
            for(int j=0;j<sz;j++){
                for(int k=0;k<sz;k++){
                    ans[i][j]+=A[i][k]*M[k][j];
                    ans[i][j]%=mod;
                }
            }
        }
        A=ans;
    };
    vector ans(4*N+1,vector<ll>(4*N+1));
    for(int i=0;i<4*N+1;i++)ans[i][i]=1;
    while(K){
        if(K&1){
            matrix_multi(ans,M);
        }
        K>>=1;
        matrix_multi(M,M);
    }
    cout<<ans[0][4*N]<<"\n";
    {
        assert(1<=N && N<=25);
        assert(1<=K && K<=1000000000000000000);
    }
}
0