結果
| 問題 | No.2111 Sum of Diff |
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2022-10-28 21:56:42 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 2,000 ms |
| コード長 | 499 bytes |
| 記録 | |
| コンパイル時間 | 2,325 ms |
| コンパイル使用メモリ | 332,156 KB |
| 実行使用メモリ | 6,144 KB |
| 最終ジャッジ日時 | 2026-03-27 11:23:31 |
| 合計ジャッジ時間 | 3,037 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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