結果

問題 No.1299 Random Array Score
ユーザー Manuel1024
提出日時 2022-01-10 03:00:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 70,308 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-14 10:40:59
合計ジャッジ時間 4,590 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
constexpr ll MOD = 998244353;

ll modpow(ll a, ll x){
    ll res = 1;
    for(; x > 0; x >>= 1){
        if(x & 1){
            res *= a;
            res %= MOD;
        }
        a *= a;
        a %= MOD;
    }
    return res;
}

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(auto &it: a) cin >> it;

    ll ans = 0;
    for(auto &it: a){
        ans += it;
        ans %= MOD;
    }
    ans *= modpow(2, k);
    ans %= MOD;
    cout << ans << endl;
    return 0;
}
0