結果

問題 No.3790 Unlabeled Slime Trees
コンテスト
ユーザー DeltaStruct
提出日時 2026-09-22 12:34:57
言語 C++23(gnu拡張)
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=gnu++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 464 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,492 ms
コンパイル使用メモリ 342,304 KB
実行使用メモリ 9,932 KB
最終ジャッジ日時 2026-11-06 20:58:28
合計ジャッジ時間 3,605 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using mint = atcoder::modint998244353;

int main(){
  ios::sync_with_stdio(false),cin.tie(0);
  vector<mint> dp(1e6+1);
  mint t = 1,inv2 = mint(1)/2;
  for (int i(3);i <= 1e6;++i){
    dp[i] = dp[i-1]*(4*t)*(2*t);
    dp[i] -= (t-1)*(2*t)*(2*t);
    dp[i] += (2*t-1)*(2*t)*inv2-1;
    t *= 2;
  }
  int q; cin >> q;
  while(q--){
  	int n; cin >> n;
  	cout << (dp[n]+1).val() << '\n';
  }
}
0