結果
問題 |
No.1299 Random Array Score
|
ユーザー |
![]() |
提出日時 | 2020-11-28 06:36:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 87 ms / 2,000 ms |
コード長 | 714 bytes |
コンパイル時間 | 1,582 ms |
コンパイル使用メモリ | 167,012 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-12 22:02:41 |
合計ジャッジ時間 | 4,418 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for(int i= 0; i < (n); i++) using ll= long long int; using namespace std; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } ll mod= 1e9 + 7; ll mmod= 998244353; ll RepeatSquaring(ll N, ll P, ll M){ if(P==0) return 1; if(P%2==0){ ll t = RepeatSquaring(N, P/2, M); return t*t % M; } return N * RepeatSquaring(N, P-1, M)%M; } int main(){ int n; ll k; cin >>n >>k; ll a[n]; ll sum=0; rep(i,n){cin >> a[i];sum+=a[i];} sum%=mmod; cout << (RepeatSquaring((ll)2,k,mmod)*sum)%mmod << endl; }