結果

問題 No.1299 Random Array Score
ユーザー 👑 platinumplatinum
提出日時 2020-11-27 22:47:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 1,253 bytes
コンパイル時間 1,471 ms
コンパイル使用メモリ 167,988 KB
実行使用メモリ 4,816 KB
最終ジャッジ日時 2023-10-09 20:49:36
合計ジャッジ時間 4,406 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 75 ms
4,596 KB
testcase_04 AC 71 ms
4,592 KB
testcase_05 AC 55 ms
4,380 KB
testcase_06 AC 49 ms
4,380 KB
testcase_07 AC 49 ms
4,376 KB
testcase_08 AC 69 ms
4,816 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 29 ms
4,376 KB
testcase_11 AC 9 ms
4,380 KB
testcase_12 AC 49 ms
4,376 KB
testcase_13 AC 69 ms
4,624 KB
testcase_14 AC 49 ms
4,376 KB
testcase_15 AC 52 ms
4,380 KB
testcase_16 AC 50 ms
4,376 KB
testcase_17 AC 11 ms
4,380 KB
testcase_18 AC 32 ms
4,380 KB
testcase_19 AC 38 ms
4,376 KB
testcase_20 AC 20 ms
4,380 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 12 ms
4,376 KB
testcase_23 AC 48 ms
4,380 KB
testcase_24 AC 55 ms
4,376 KB
testcase_25 AC 47 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 13 ms
4,376 KB
testcase_28 AC 10 ms
4,380 KB
testcase_29 AC 16 ms
4,376 KB
testcase_30 AC 46 ms
4,380 KB
testcase_31 AC 17 ms
4,376 KB
testcase_32 AC 69 ms
4,592 KB
testcase_33 AC 80 ms
4,532 KB
testcase_34 AC 30 ms
4,596 KB
testcase_35 AC 82 ms
4,584 KB
testcase_36 AC 29 ms
4,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;

LL const mod = 998244353;
struct mint{
	LL x;
	mint(LL x = 0): x(x % mod) {}
	mint& operator += (const mint n){
		x += n.x;
		if(x >= mod) x -= mod;
		return *this;
	}
	mint& operator -= (const mint n){
		x -= n.x;
		if(x < 0) x += mod;
		return *this;
	}
	mint& operator *= (const mint n){
		x *= n.x;
		x %= mod;
		return *this;
	}
	mint operator + (const mint n) const{
		mint res(*this);
		return res += n;
	}
	mint operator - (const mint n) const{
		mint res(*this);
		return res -= n;
	}
	mint operator * (const mint n) const{
		mint res(*this);
		return res *= n;
	}
	mint pow(LL n) const{
		if(n == 0) return 1;
		mint m = pow(n >> 1);
		m *= m;
		if(n & 1) m *= *this;
		return m;
	}
	// mint division for prime mod
	mint inv() const{
		return pow(mod - 2);
	}
	mint& operator /= (const mint n){
		return (*this) *= n.inv();
	}
	mint operator / (const mint n) const{
		mint res(*this);
		return res /= n;
	}
};

int main(){
	int N;
	LL K;
	cin >> N >> K;
	vector<LL> A(N);
	rep(i,N) cin >> A[i];
	mint sum = 0;
	rep(i,N) sum += A[i];
	mint a = 2;
	sum *= a.pow(K);
	cout << sum.x << endl;

	return 0;
}
0