結果
| 問題 | No.1299 Random Array Score | 
| コンテスト | |
| ユーザー |  planes | 
| 提出日時 | 2022-07-29 20:46:29 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 84 ms / 2,000 ms | 
| コード長 | 604 bytes | 
| コンパイル時間 | 1,415 ms | 
| コンパイル使用メモリ | 168,332 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-19 11:34:12 | 
| 合計ジャッジ時間 | 4,147 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 34 | 
ソースコード
#include <bits/stdc++.h> 
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 #define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
ll mod=998244353;
ll mod_pow(ll x,ll n,ll mod) {
ll res=1;
  while(n>0) {
if(n&1) {
res=res*x%mod;
}
   x=x*x%mod;
    n>>=1;
  }
return res;
}
int main() {
 ll N,K;cin>>N>>K;
 vector<ll> A(N);
 for(ll i=0;i<N;i++) cin>>A[i];
ll s=0;
for(ll i=0;i<N;i++) s+=A[i];
ll E=1;
E*=s;
E%=mod;
ll ans=mod_pow(2,K,mod)-1;
ans%=mod;
ans*=E;
ans%=mod;
if(ans<0) ans+=mod;
ans+=s;
ans%=mod;
cout<<ans<<endl;
}
  
  
            
            
            
        