結果
| 問題 |
No.1325 Subsequence Score
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2020-12-22 01:39:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 65 ms / 2,000 ms |
| コード長 | 566 bytes |
| コンパイル時間 | 973 ms |
| コンパイル使用メモリ | 88,984 KB |
| 最終ジャッジ日時 | 2025-01-17 06:01:10 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;
constexpr int P = 998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
ll r, t = 1;
cin >> r;
r %= P;
for (int i = 1; i < n; i++) {
int a;
cin >> a;
r *= 2;
r += ((i + 2) * t) % P * a;
r %= P;
t *= 2;
if (t >= P) t -= P;
}
cout << r << endl;
return 0;
}
merom686