結果
| 問題 | No.2206 Popcount Sum 2 |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-08-02 16:35:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,338 bytes |
| 記録 | |
| コンパイル時間 | 1,563 ms |
| コンパイル使用メモリ | 158,628 KB |
| 実行使用メモリ | 8,532 KB |
| 最終ジャッジ日時 | 2025-08-02 16:35:40 |
| 合計ジャッジ時間 | 10,612 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 TLE * 1 -- * 13 |
コンパイルメッセージ
main.cpp: In function ‘long long int read()’:
main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%lld", &x); return x;
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define LL long long
typedef pair<int,int> PII;
char buf[1 << 21], *p1 = buf, *p2 = buf;
char gc(){
if(p1 == p2)p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin);
return *(p1) ++;
}
LL read(){
LL x = 0, s = 1;
scanf("%lld", &x); return x;
char ch = gc();
while(ch < '0' || ch > '9')s = ch == '-' ? -1 : s, ch = gc();
while('0' <= ch && ch <= '9')x = (x << 1ll) + (x << 3ll) + (ch ^ 48), ch = gc();
return x * s;
}
const int N = 2e5 + 10;
const int mod = 998244353;
int fac[N], inv[N];
int qpw(int d, int u){
int res = 1;
while(u){
if(u & 1)res = res * d % mod;
d = d * d % mod; u >>= 1;
}
return res;
}
void pre(){
fac[0] = inv[0] = 1;
for(int i = 1; i <= N - 5; i ++)fac[i] = fac[i - 1] * i % mod, inv[i] = qpw(fac[i], mod - 2);
}
int C(int x, int y){return y > x ? 0 : fac[x] * inv[y] % mod * inv[x - y] % mod; }
int n, m;
void solve(int qid){
n = read(); m = read();
int ans = 0, tmp = 0, pw2 = 1;
for(int i = 0; i <= m - 1; i ++)tmp = (tmp + C(n - 1, i)) % mod;
for(int i = 0; i < n; i ++)ans = (ans + pw2 * tmp % mod) % mod, pw2 = pw2 * 2ll % mod;
printf("%lld\n", ans);
}
signed main(){
pre();
int qii = read();
for(int z = 1; z <= qii; z ++)solve(z);
}
vjudge1