結果
問題 |
No.2206 Popcount Sum 2
|
ユーザー |
![]() |
提出日時 | 2025-08-01 20:30:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 913 bytes |
コンパイル時間 | 1,395 ms |
コンパイル使用メモリ | 163,384 KB |
実行使用メモリ | 15,732 KB |
最終ジャッジ日時 | 2025-08-01 20:30:58 |
合計ジャッジ時間 | 8,862 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 TLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 2e5 + 5; const int mod = 998244353; int inv[N], fac[N], pw[N]; int qpow ( int x, int p = mod - 2 ) { int res = 1; while ( p ) { if ( p & 1 ) res = res * x % mod; x = x * x % mod; p >>= 1; } return res; } int choose ( int n, int m ) { return fac[n] * inv[m] % mod * inv[n - m] % mod; } int pls ( int x, int y ) { return x + y >= mod ? x + y - mod : x + y; } signed main ( ) { int t; cin >> t; pw[0] = fac[0] = inv[0] = 1; for ( int i = 1; i <= 200000; i ++ ) fac[i] = fac[i - 1] * i % mod, inv[i] = qpow ( fac[i] ); for ( int i = 1; i <= 200000; i ++ ) pw[i] = pls ( pw[i - 1], pw[i - 1] ); while ( t -- ) { int n, m, ans = 0; cin >> n >> m; for ( int i = 0; i < m; i ++ ) ans = ( ans + choose ( n - 1, i ) ) % mod ; cout << ( ans * ( pw[n] - 1 ) % mod + mod ) % mod << "\n"; } }