結果

問題 No.1299 Random Array Score
ユーザー iomiriomir
提出日時 2023-04-02 00:51:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 1,815 ms
コンパイル使用メモリ 168,504 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 14:35:09
合計ジャッジ時間 4,572 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
using ll = long long;
using ull = unsigned long long;
using vll=vector<ll>;
using vvll = vector<vector<ll>>;
const ll INF=1ll<<60;
using vp=vector<pair<ll, ll>>;
ll mod=998244353;

ll powmod(ll x,ll n,ll m){
    ll res=1;
    while(n>0){
        if(n&1) res*=x;
        x*=x;
        res%=m;
        x%=m;
        n>>=1;
    }
    return res;
}

int main(){
    ll N,K;
    cin>>N>>K;
    vll A(N);
    ll sum=0;
    for(int i=0;i<N;i++){
        cin>>A[i];
        sum+=A[i];
    }

    cout << sum%mod*powmod(2,K,mod)%mod << endl;
}
0