結果

問題 No.1299 Random Array Score
ユーザー carrot46carrot46
提出日時 2020-11-28 11:17:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 2,688 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 167,248 KB
実行使用メモリ 4,848 KB
最終ジャッジ日時 2023-10-09 23:46:33
合計ジャッジ時間 4,732 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 76 ms
4,744 KB
testcase_04 AC 74 ms
4,756 KB
testcase_05 AC 59 ms
4,376 KB
testcase_06 AC 51 ms
4,348 KB
testcase_07 AC 55 ms
4,360 KB
testcase_08 AC 74 ms
4,580 KB
testcase_09 AC 4 ms
4,352 KB
testcase_10 AC 30 ms
4,348 KB
testcase_11 AC 9 ms
4,348 KB
testcase_12 AC 49 ms
4,348 KB
testcase_13 AC 75 ms
4,676 KB
testcase_14 AC 51 ms
4,348 KB
testcase_15 AC 53 ms
4,372 KB
testcase_16 AC 52 ms
4,376 KB
testcase_17 AC 12 ms
4,352 KB
testcase_18 AC 33 ms
4,352 KB
testcase_19 AC 39 ms
4,352 KB
testcase_20 AC 21 ms
4,348 KB
testcase_21 AC 3 ms
4,348 KB
testcase_22 AC 12 ms
4,348 KB
testcase_23 AC 51 ms
4,352 KB
testcase_24 AC 58 ms
4,352 KB
testcase_25 AC 51 ms
4,376 KB
testcase_26 AC 3 ms
4,352 KB
testcase_27 AC 15 ms
4,352 KB
testcase_28 AC 11 ms
4,352 KB
testcase_29 AC 17 ms
4,348 KB
testcase_30 AC 48 ms
4,376 KB
testcase_31 AC 18 ms
4,348 KB
testcase_32 AC 74 ms
4,848 KB
testcase_33 AC 83 ms
4,756 KB
testcase_34 AC 31 ms
4,840 KB
testcase_35 AC 83 ms
4,604 KB
testcase_36 AC 30 ms
4,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <chrono>
//#pragma GCC optimize("O3")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}

template <unsigned long long mod > class modint{
public:
    ll x;
    constexpr modint(){x = 0;}
    constexpr modint(ll _x) : x((_x < 0 ? ((_x += (LLONG_MAX / mod) * mod) < 0 ? _x + (LLONG_MAX / mod) * mod : _x) : _x)%mod){}
    constexpr modint set_raw(ll _x){
        //_x in [0, mod)
        x = _x;
        return *this;
    }
    constexpr modint operator-(){
        return x == 0 ? 0 : mod - x;
    }
    constexpr modint& operator+=(const modint& a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr modint operator+(const modint& a) const{
        return modint(*this) += a;
    }
    constexpr modint& operator-=(const modint& a){
        if((x -= a.x) < 0) x += mod;
        return *this;
    }
    constexpr modint operator-(const modint& a) const{
        return modint(*this) -= a;
    }
    constexpr modint& operator*=(const modint& a){
        (x *= a.x)%=mod;
        return *this;
    }
    constexpr modint operator*(const modint& a) const{
        return modint(*this) *= a;
    }
    constexpr modint pow(unsigned long long pw) const{
        modint res(1), comp(*this);
        while(pw){
            if(pw&1) res *= comp;
            comp *= comp;
            pw >>= 1;
        }
        return res;
    }
    //以下、modが素数のときのみ
    constexpr modint inv() const{
        if(x == 2) return (mod + 1) >> 1;
        return modint(*this).pow(mod - 2);
    }
    constexpr modint& operator/=(const modint &a){
        (x *= a.inv().x)%=mod;
        return *this;
    }
    constexpr modint operator/(const modint &a) const{
        return modint(*this) /= a;
    }
};
#define mod1 998244353
#define mod2 1000000007
using mint = modint<mod1>;

ostream& operator<<(ostream& os, const mint& a){
    os << a.x;
    return os;
}
using vm = vector<mint>;

int main(){
    cin>>N>>K;
    vm a(N);
    rep(i, N) {
        cin>>A;
        a[i].x = A%mod1;
    }
    cout<<accumulate(ALL(a), mint(0)) * mint(2).pow(K)<<endl;
}
0