結果
問題 | No.2113 Distance Sequence 1.5 |
ユーザー |
![]() |
提出日時 | 2022-10-28 22:37:57 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 497 bytes |
コンパイル時間 | 2,926 ms |
コンパイル使用メモリ | 247,352 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 01:49:55 |
合計ジャッジ時間 | 3,801 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/modint>using ll = long long;using Fp = atcoder::modint998244353;void solve(std::istream& is, std::ostream& os) {ll N, M, K;is >> N >> M >> K;if (M <= K) {os << Fp(M).pow(2 * N).val() << '\n';} else {Fp ans = Fp(K).pow(2 * N) * (M - K + 1);ans -= Fp(K - 1).pow(2 * N) * (M - K);os << ans.val() << '\n';}}int main() {std::ios::sync_with_stdio(false);std::cin.tie(nullptr);solve(std::cin, std::cout);}