結果

問題 No.1299 Random Array Score
ユーザー KKT89
提出日時 2020-12-08 06:16:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 700 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 195,664 KB
最終ジャッジ日時 2025-01-16 19:32:14
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

constexpr ll mod=998244353;

ll mod_pow(ll a,ll b){
    a%=mod;
    if(b==0)return 1;
    if(b==1)return a;
    ll res=mod_pow(a,b/2)%mod;
    res*=res; res%=mod;
    if(b%2)res*=a;
    return res%mod;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    ll k; cin >> k;
    vector<ll> a(n);
    ll sum=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum+=a[i]; sum%=mod;
    }
    cout << mod_pow(2,k)*sum%mod << endl;
}
0