結果

問題 No.1299 Random Array Score
ユーザー Izayoi_R_sakuraIzayoi_R_sakura
提出日時 2020-11-27 21:46:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 1,426 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 128,536 KB
実行使用メモリ 4,900 KB
最終ジャッジ日時 2023-10-01 05:15:33
合計ジャッジ時間 4,596 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 77 ms
4,900 KB
testcase_04 AC 75 ms
4,640 KB
testcase_05 AC 58 ms
4,376 KB
testcase_06 AC 52 ms
4,380 KB
testcase_07 AC 55 ms
4,376 KB
testcase_08 AC 74 ms
4,640 KB
testcase_09 AC 4 ms
4,384 KB
testcase_10 AC 30 ms
4,380 KB
testcase_11 AC 9 ms
4,376 KB
testcase_12 AC 49 ms
4,380 KB
testcase_13 AC 73 ms
4,672 KB
testcase_14 AC 51 ms
4,380 KB
testcase_15 AC 52 ms
4,376 KB
testcase_16 AC 51 ms
4,376 KB
testcase_17 AC 12 ms
4,380 KB
testcase_18 AC 33 ms
4,376 KB
testcase_19 AC 38 ms
4,376 KB
testcase_20 AC 21 ms
4,376 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 13 ms
4,380 KB
testcase_23 AC 51 ms
4,376 KB
testcase_24 AC 58 ms
4,376 KB
testcase_25 AC 51 ms
4,376 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 14 ms
4,376 KB
testcase_28 AC 10 ms
4,380 KB
testcase_29 AC 17 ms
4,376 KB
testcase_30 AC 48 ms
4,380 KB
testcase_31 AC 18 ms
4,380 KB
testcase_32 AC 71 ms
4,900 KB
testcase_33 AC 83 ms
4,580 KB
testcase_34 AC 30 ms
4,872 KB
testcase_35 AC 83 ms
4,656 KB
testcase_36 AC 30 ms
4,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <math.h>
#include <random>
#include <chrono>
using namespace std ;
using ll = long long ;
using ld = long double ;
template<class T> using V = vector<T> ;
template<class T> using VV = V<V<T>> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
ll mod = 998244353 ;
long double pie = acos(-1) ;
ll INF = 1000000000000 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
void fix_cout(){cout << fixed << setprecision(20) ;}
template<class T> void chmax(T &a,T &b){if(a<b) a = b ;}
template<class T> void chmin(T &a,T &b){if(a>b) a = b ;}

ll modpow(ll a,ll b){
	ll res = 1 ;
	while(b){
		if(b&1) res = res*a%mod ;
		a = a*a%mod ;
		b >>= 1 ;
	}
	return res ;
}

int main(){
	int n ; cin >> n ;
	ll k ; cin >> k ;
	V<ll> a(n) ;
	for(auto &i:a) cin >> i ;
	ll sum = 0 ;
	for(int i=0;i<n;i++) sum += a[i] ;
	if(k==0){
		cout << sum%mod << endl ;
	}else{
		sum %= mod ;
		sum = sum*modpow(2*n,k)%mod ;
		cout << sum*modpow(modpow(n,k),mod-2)%mod << endl ;
	}
}
0