結果
問題 |
No.2206 Popcount Sum 2
|
ユーザー |
![]() |
提出日時 | 2025-08-02 16:04:19 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 814 bytes |
コンパイル時間 | 2,835 ms |
コンパイル使用メモリ | 276,332 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-02 16:04:30 |
合計ジャッジ時間 | 10,674 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 TLE * 1 -- * 13 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:23:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | scanf("%d%d",&n,&m); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; const int N=2e5+10,mod=998244353; int n,m,bin[N]; int fac[N],inv[N],invp[N]; int qpow(int bas,int ind) { int prd=1; for (;ind;ind>>=1) { if (ind&1) prd=1ll*prd*bas%mod; bas=1ll*bas*bas%mod; } return prd; } int C(int x,int y) { if (y<0||x>y) return 0; return 1ll*fac[y]*invp[x]%mod*invp[y-x]%mod; } void solve() { scanf("%d%d",&n,&m); int a=0,b=(bin[n]+mod-1)%mod; for (int i=0;i<m;i++) (a+=C(i,n-1))%=mod; printf("%lld\n",1ll*a*b%mod); } int main() { n=2e5; bin[0]=1; for (int i=1;i<=n;i++) bin[i]=2*bin[i-1]%mod; fac[0]=inv[0]=invp[0]=1; fac[1]=inv[1]=invp[1]=1; for (int i=2;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod, inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod, invp[i]=1ll*invp[i-1]*inv[i]%mod; int TT; cin>>TT; while (TT--) solve(); return 0; }