結果
| 問題 |
No.1299 Random Array Score
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-30 19:28:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 86 ms / 2,000 ms |
| コード長 | 1,019 bytes |
| コンパイル時間 | 1,085 ms |
| コンパイル使用メモリ | 92,744 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-13 02:29:44 |
| 合計ジャッジ時間 | 3,934 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long sum = 0;
int main() {
long long n, k;
cin >> n >> k;
for (int i = 0; i < n; i++) {
long long a;
cin >> a;
sum += a;
sum %= 998244353;
}
long long x = n * 2;
long long y = k;
long long ans = 1;
while (y > 0) {
if ((y & 1) == 1) {
ans = ans * x % 998244353;
}
x = x * x % 998244353;
y >>= 1;
}
x = n;
y = k;
long long ans1 = 1;
while (y > 0) {
if ((y & 1) == 1) {
ans1 = ans1 * x % 998244353;
}
x = x * x % 998244353;
y >>= 1;
}
x = ans1;
y = 998244351;
long long ans2 = 1;
while (y > 0) {
if ((y & 1) == 1) {
ans2 = ans2 * x % 998244353;
}
x = x * x % 998244353;
y >>= 1;
}
sum *= ans;
sum %= 998244353;
sum *= ans2;
sum %= 998244353;
cout << sum << endl;
}