結果
| 問題 | No.1299 Random Array Score | 
| コンテスト | |
| ユーザー |  keep_OC | 
| 提出日時 | 2020-11-27 22:25:35 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 27 ms / 2,000 ms | 
| コード長 | 1,721 bytes | 
| コンパイル時間 | 2,188 ms | 
| コンパイル使用メモリ | 194,100 KB | 
| 最終ジャッジ日時 | 2025-01-16 07:47:45 | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 34 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
// //using mint = modint1000000007;
// using mint = modint998244353;
typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
//const Int mod = 1e9+7;
const Int mod = 998244353;
template<class T> 
istream &operator>>(istream &is, vector<T> &v) { 
    for (auto &e : v) {
        is >> e; 
    }
    return is; 
}
bool print_space_enable = false;
void print() { 
    std::cout << '\n'; 
    print_space_enable = false;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) std::cout << " ";
    std::cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}
template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << '\n';
}
void fast_IO() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
// 繰り返し二乗法
// x ^ p (mod m)
int64_t mod_pow(int64_t x, int64_t p, int64_t m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int64_t t = mod_pow(x, p / 2, m);
        return t * t % m;
    }
    return x * mod_pow(x, p - 1, m) % m;
}
void solve() {
    fast_IO();
    Int n, k;
    cin >> n >> k;
    vector<Int> a(n);
    cin >> a;
    Int mul = mod_pow(2, k, mod);
    mul = (mul - 1 + mod) % mod;
    Int sum = accumulate(all(a), (Int)0);
    Int add = sum % mod;
    sum %= mod;
    sum = sum * mul % mod;
    print((add + sum) % mod);
}
int main() {
    solve();
    return 0;
}
            
            
            
        