結果

問題 No.1299 Random Array Score
ユーザー 👑 NachiaNachia
提出日時 2020-11-27 21:32:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 2,052 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 198,896 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-10-01 04:56:37
合計ジャッジ時間 5,032 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 71 ms
4,376 KB
testcase_04 AC 66 ms
4,380 KB
testcase_05 AC 52 ms
4,376 KB
testcase_06 AC 48 ms
4,376 KB
testcase_07 AC 51 ms
4,380 KB
testcase_08 AC 69 ms
4,380 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 29 ms
4,376 KB
testcase_11 AC 9 ms
4,376 KB
testcase_12 AC 45 ms
4,376 KB
testcase_13 AC 67 ms
4,376 KB
testcase_14 AC 47 ms
4,376 KB
testcase_15 AC 49 ms
4,380 KB
testcase_16 AC 47 ms
4,380 KB
testcase_17 AC 10 ms
4,376 KB
testcase_18 AC 31 ms
4,380 KB
testcase_19 AC 36 ms
4,376 KB
testcase_20 AC 20 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 12 ms
4,376 KB
testcase_23 AC 48 ms
4,376 KB
testcase_24 AC 55 ms
4,380 KB
testcase_25 AC 47 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 14 ms
4,380 KB
testcase_28 AC 10 ms
4,380 KB
testcase_29 AC 15 ms
4,376 KB
testcase_30 AC 45 ms
4,380 KB
testcase_31 AC 17 ms
4,376 KB
testcase_32 AC 65 ms
4,380 KB
testcase_33 AC 77 ms
4,380 KB
testcase_34 AC 28 ms
4,376 KB
testcase_35 AC 76 ms
4,380 KB
testcase_36 AC 28 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0;i<(n);i++)

template<ULL M>
struct static_modint {
	ULL x;
	static_modint(ULL val = 0) : x(val) {}
	template<class intTy, enable_if_t<is_integral<intTy>::value&& is_unsigned<intTy>::value, void*> isUnsignedInt = nullptr>
	static static_modint mod_construct(intTy val) { return static_modint(val % M); }
	template<class intTy, enable_if_t<is_integral<intTy>::value&& is_signed<intTy>::value, void*> isSignedInt = nullptr>
	static static_modint mod_construct(intTy val) { LL buf = val % (LL)M; if (buf < 0) buf += M; return static_modint((ULL)buf); }

	static_modint operator-() const { if (x == 0) return 0; else return M - x; }
	static_modint& operator+=(static_modint r) { x += r.x; if (x >= M) x -= M; return *this; }
	static_modint operator+(static_modint r) const { static_modint res = x; return res += r; }
	static_modint& operator-=(static_modint r) { x += M - r.x; if (x >= M) x -= M; return *this; }
	static_modint operator-(static_modint r) const { static_modint res = x; return res -= r; }
	static_modint& operator*=(static_modint r) { x = x * r.x % M; return *this; }
	static_modint operator*(static_modint r) const { return static_modint(x * r.x % M); }
	static_modint pow(ULL r) const {
		if (r == 0) return static_modint(1);
		static_modint res = pow(r / 2);
		res *= res;
		if (r % 2) res *= *this;
		return res;
	}
	static_modint inv() const { return pow(M - 2); }
	static_modint& operator/=(static_modint r) { *this *= r.inv(); return *this; }
	static_modint operator/(static_modint r) const { return *this * r.inv(); }
	ULL& operator*() { return x; }
	const ULL& operator*() const { return x; }
	bool operator==(static_modint r) const { return x == *r; }
	bool operator!=(static_modint r) const { return x != *r; }
};

using MLL = static_modint<998244353>;

int main(){
  int N; ULL K; cin>>N>>K;
  MLL A = 0;
  rep(i,N){ int a; cin>>a; A+=a%998244353; }
  A *= MLL(2).pow(K);
  cout<<*A<<endl;
  return 0;
}

0