結果
| 問題 |
No.2816 At Most Two Moves
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2024-07-19 23:00:11 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 514 bytes |
| コンパイル時間 | 3,328 ms |
| コンパイル使用メモリ | 247,344 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 23:00:17 |
| 合計ジャッジ時間 | 3,908 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using Int = int64_t;
using Mint = atcoder::modint998244353;
void Solve() {
Int n;
std::cin >> n;
Mint ans = Mint(2).inv();
if (2 < n) {
ans += Mint(2).inv() * (1 - (1 - Mint(4).inv()).pow(n - 2));
}
ans *= n - 1;
ans += 1;
ans *= Mint(2).pow(n * (n - 1) / 2);
std::cout << ans.val() << '\n';
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
Int t;
std::cin >> t;
while (t--) {
Solve();
}
}
risujiroh