結果
| 問題 |
No.2111 Sum of Diff
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2022-10-28 21:56:42 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 58 ms / 2,000 ms |
| コード長 | 499 bytes |
| コンパイル時間 | 2,995 ms |
| コンパイル使用メモリ | 245,564 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-06 01:03:59 |
| 合計ジャッジ時間 | 4,543 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using Fp = atcoder::modint998244353;
void solve(std::istream& is, std::ostream& os) {
int N;
is >> N;
Fp ans = 0;
for (int i = 0; i < N; ++i) {
int a;
is >> a;
if (i + 1 < N) {
ans += a * (Fp(2).pow(N - i - 1) - 1);
}
if (i) {
ans -= a * (Fp(2).pow(i) - 1);
}
}
os << ans.val() << '\n';
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
solve(std::cin, std::cout);
}
risujiroh