結果
問題 |
No.2206 Popcount Sum 2
|
ユーザー |
![]() |
提出日時 | 2025-08-02 16:05:22 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 924 bytes |
コンパイル時間 | 3,052 ms |
コンパイル使用メモリ | 275,688 KB |
実行使用メモリ | 15,724 KB |
最終ジャッジ日時 | 2025-08-02 16:05:34 |
合計ジャッジ時間 | 11,497 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 TLE * 1 -- * 13 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:32:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 32 | LL n, m; scanf("%lld%lld", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~~~~~ main.cpp: In function ‘int main()’: main.cpp:44:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 44 | LL T; scanf("%lld", &T); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long LL; const LL N = 2e5 + 10, mod = 998244353; LL p2[N], fac[N], inv[N]; LL qmi(LL a, LL b) { LL res = 1; while (b) { if (b & 1) res = res * a % mod; a = a * a % mod, b >>= 1; } return res; } void init() { p2[0] = 1, fac[0] = 1; for (LL i = 1; i < N; i ++ ) p2[i] = p2[i - 1] * 2 % mod, fac[i] = fac[i - 1] * i % mod; inv[N - 1] = qmi(fac[N - 1], mod - 2); for (LL i = N - 2; ~i; i -- ) inv[i] = inv[i + 1] * (i + 1) % mod; } LL C(LL a, LL b) {return fac[a] * inv[b] % mod * inv[a - b] % mod;} void solve() { LL n, m; scanf("%lld%lld", &n, &m); // ??? 1 ??? <= m - 1 LL cnt = 0; for (LL i = 0; i <= m - 1; i ++ ) cnt = (cnt + C(n - 1, i)) % mod; LL res = 0; for (LL i = 0; i < n; i ++ ) res = (res + p2[i] * cnt % mod) % mod; printf("%lld\n", res); } int main() { init(); LL T; scanf("%lld", &T); while (T -- ) solve(); return 0; }