結果

問題 No.1299 Random Array Score
ユーザー monnu
提出日時 2021-04-17 23:14:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 605 bytes
コンパイル時間 1,433 ms
コンパイル使用メモリ 170,216 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-04 04:17:00
合計ジャッジ時間 5,127 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 200003
#define MOD 998244353
#define INF 1000000000

ll modpow(ll a,ll x){
  ll ret=1;
  a%=MOD;
  while(x>0){
    if(x%2==1){
      ret=ret*a%MOD;
    }
    a=a*a%MOD;
    x>>=1;
  }
  return ret;
}

ll modinv(ll x){
  return modpow(x,MOD-2);
}

int main(){
  ll N;
  ll K;
  cin>>N>>K;
  vector<ll> A(N);
  ll sum=0;
  for(int i=0;i<N;i++){
    cin>>A[i];
    sum+=A[i];
  }
  sum%=MOD;
  sum*=modpow(2,K);
  sum%=MOD;
  cout<<sum<<endl;
}
0