結果

問題 No.1299 Random Array Score
ユーザー mkmkmkmkmkmkmkmk
提出日時 2020-11-27 22:18:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 1,935 bytes
コンパイル時間 1,682 ms
コンパイル使用メモリ 165,380 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-10-01 06:30:21
合計ジャッジ時間 4,807 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 76 ms
4,376 KB
testcase_04 AC 73 ms
4,380 KB
testcase_05 AC 57 ms
4,380 KB
testcase_06 AC 51 ms
4,380 KB
testcase_07 AC 53 ms
4,380 KB
testcase_08 AC 72 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 30 ms
4,380 KB
testcase_11 AC 9 ms
4,380 KB
testcase_12 AC 48 ms
4,376 KB
testcase_13 AC 71 ms
4,376 KB
testcase_14 AC 50 ms
4,380 KB
testcase_15 AC 52 ms
4,376 KB
testcase_16 AC 50 ms
4,380 KB
testcase_17 AC 12 ms
4,380 KB
testcase_18 AC 33 ms
4,380 KB
testcase_19 AC 38 ms
4,376 KB
testcase_20 AC 21 ms
4,376 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 13 ms
4,376 KB
testcase_23 AC 50 ms
4,380 KB
testcase_24 AC 56 ms
4,376 KB
testcase_25 AC 51 ms
4,376 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 14 ms
4,376 KB
testcase_28 AC 10 ms
4,380 KB
testcase_29 AC 17 ms
4,376 KB
testcase_30 AC 48 ms
4,376 KB
testcase_31 AC 18 ms
4,376 KB
testcase_32 AC 71 ms
4,376 KB
testcase_33 AC 81 ms
4,376 KB
testcase_34 AC 29 ms
4,380 KB
testcase_35 AC 82 ms
4,376 KB
testcase_36 AC 29 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
//const lint MOD =1000000007;
const lint MOD=998244353;
const lint MAX = 4000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)

 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 


   
    int main(){
        lint n,k;
        cin>>n>>k;
        lint sum=0;
        rep(i,n){
            lint a;
            cin>>a;
            sum+=a;
        }
        sum%=MOD;
        lint ans=modpow(2,k,MOD);
        ans*=sum;
        ans%=MOD;
        cout<<ans<<endl;

        
    }
      
0