結果
問題 | No.1299 Random Array Score |
ユーザー | kkktym |
提出日時 | 2020-11-27 22:26:44 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 83 ms / 2,000 ms |
コード長 | 2,133 bytes |
コンパイル時間 | 1,033 ms |
コンパイル使用メモリ | 101,044 KB |
実行使用メモリ | 4,712 KB |
最終ジャッジ日時 | 2023-10-09 20:28:06 |
合計ジャッジ時間 | 4,106 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,384 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 76 ms
4,676 KB |
testcase_04 | AC | 75 ms
4,568 KB |
testcase_05 | AC | 58 ms
4,384 KB |
testcase_06 | AC | 51 ms
4,376 KB |
testcase_07 | AC | 54 ms
4,376 KB |
testcase_08 | AC | 74 ms
4,712 KB |
testcase_09 | AC | 4 ms
4,380 KB |
testcase_10 | AC | 30 ms
4,376 KB |
testcase_11 | AC | 9 ms
4,376 KB |
testcase_12 | AC | 49 ms
4,380 KB |
testcase_13 | AC | 73 ms
4,644 KB |
testcase_14 | AC | 50 ms
4,380 KB |
testcase_15 | AC | 52 ms
4,380 KB |
testcase_16 | AC | 52 ms
4,380 KB |
testcase_17 | AC | 11 ms
4,384 KB |
testcase_18 | AC | 33 ms
4,380 KB |
testcase_19 | AC | 38 ms
4,380 KB |
testcase_20 | AC | 21 ms
4,376 KB |
testcase_21 | AC | 3 ms
4,376 KB |
testcase_22 | AC | 13 ms
4,384 KB |
testcase_23 | AC | 51 ms
4,384 KB |
testcase_24 | AC | 57 ms
4,376 KB |
testcase_25 | AC | 50 ms
4,380 KB |
testcase_26 | AC | 2 ms
4,376 KB |
testcase_27 | AC | 15 ms
4,376 KB |
testcase_28 | AC | 10 ms
4,376 KB |
testcase_29 | AC | 16 ms
4,384 KB |
testcase_30 | AC | 48 ms
4,380 KB |
testcase_31 | AC | 18 ms
4,376 KB |
testcase_32 | AC | 72 ms
4,380 KB |
testcase_33 | AC | 83 ms
4,588 KB |
testcase_34 | AC | 30 ms
4,672 KB |
testcase_35 | AC | 83 ms
4,572 KB |
testcase_36 | AC | 30 ms
4,588 KB |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <utility> #include <set> #include <map> #include <cmath> #include <queue> #include <cstdio> #include <limits> #define rep(i,n) for(int i = 0; i < n; ++i) #define rep1(i,n) for(int i = 1; i <= n; ++i) using namespace std; template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; } template<class T> inline int sz(T &a) { return a.size(); } using ll = long long; using ld = long double; using pi = pair<int,int>; using pl = pair<ll,ll>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; const int inf = numeric_limits<int>::max(); const ll infll = numeric_limits<ll>::max(); // Modint // modint<MOD> で宣言 template<ll MOD> struct modint{ ll x; ll mod = MOD; modint(ll x=0):x(x%MOD){} modint& operator+=(const modint a){ if((x+=a.x)>=MOD) x-=MOD; return *this; } modint& operator-=(const modint a){ if((x += MOD-a.x)>=MOD) x-=MOD; return *this; } modint& operator*=(const modint a){ (x*=a.x)%=MOD; return *this; } modint operator+(const modint a) const{ modint res(*this); return res+=a; } modint operator-(const modint a) const{ modint res(*this); return res-=a; } modint operator*(const modint a) const{ modint res(*this); return res*=a; } modint pow(ll t) const{ if(!t) return 1; modint a = pow(t>>1); a*=a; if(t&1) a*=*this; return a; } //for prime mod modint inv() const{ return pow(MOD-2); } modint& operator/=(const modint a){ return (*this) *= a.inv(); } modint operator/(const modint a) const{ modint res(*this); return res/=a; } }; using mint = modint<998244353>; int main() { ll n,k; cin >> n >> k; vl a(n); rep(i,n) cin >> a[i]; mint sum; rep(i,n) sum += mint(a[i]); mint n1(n), n2(2*n); mint res; mint tmp = n1.pow(k); res = sum * tmp * (mint(2).pow(k)); res /= tmp; cout << res.x << "\n"; return 0; }