Submission #17268751
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define int long long void read (int &x) { char ch = getchar(); x = 0; while (!isdigit(ch)) ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); } const int N = 4010, mod = 998244353; int n, k, pw[N], in[N], p[N]; int qpow (int x, int y) { int t = 1; while (y) { if (y & 1) t = t * x % mod; x = x * x % mod, y >>= 1; } return t; } int C (int x, int y) { return pw[x] * in[y] % mod * in[x - y] % mod; } signed main() { read (k), read (n); pw[0] = p[0] = 1; for (int i = 1; i < N; ++i) pw[i] = pw[i - 1] * i % mod, p[i] = p[i - 1] * 2 % mod; in[N - 1] = qpow (pw[N - 1], mod - 2); for (int i = N - 2; i >= 0; --i) in[i] = in[i + 1] * (i + 1) % mod; // for (int i = 0; i <= 10; ++i) printf ("%lld ", in[i]); puts (""); for (int i = 2; i <= k * 2; ++i) { int num = k - i + 1, res = 0; int tmp = i / 2 - (i % 2 == 0); if (i > k) { tmp = (k + k - i + 1) / 2; num = i - k - 1; } // printf ("%d %d\n", num, tmp); for (int j = 0; j <= tmp; ++j) { if (n >= j) res = (res + C (tmp, j) * C (n + num - 1, n - j) % mod * p[j]) % mod; if (i % 2 == 0 && n > j) res = (res + C (tmp, j) * C (n + num - 2, n - j - 1) % mod * p[j]) % mod; } printf ("%lld\n", res); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Stop. Otherwise... |
User | OIer_whx |
Language | C++ (GCC 9.2.1) |
Score | 700 |
Code Size | 1495 Byte |
Status | AC |
Exec Time | 38 ms |
Memory | 3816 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 700 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 38 ms | 3504 KiB |
02.txt | AC | 32 ms | 3504 KiB |
03.txt | AC | 33 ms | 3728 KiB |
04.txt | AC | 2 ms | 3504 KiB |
05.txt | AC | 8 ms | 3700 KiB |
06.txt | AC | 32 ms | 3616 KiB |
07.txt | AC | 35 ms | 3816 KiB |
08.txt | AC | 9 ms | 3632 KiB |
09.txt | AC | 2 ms | 3812 KiB |
10.txt | AC | 6 ms | 3700 KiB |
11.txt | AC | 9 ms | 3632 KiB |
12.txt | AC | 2 ms | 3708 KiB |
13.txt | AC | 11 ms | 3632 KiB |
14.txt | AC | 33 ms | 3692 KiB |
15.txt | AC | 32 ms | 3620 KiB |
16.txt | AC | 27 ms | 3704 KiB |
17.txt | AC | 2 ms | 3740 KiB |
18.txt | AC | 1 ms | 3756 KiB |
19.txt | AC | 2 ms | 3672 KiB |
20.txt | AC | 2 ms | 3628 KiB |
s1.txt | AC | 2 ms | 3744 KiB |
s2.txt | AC | 2 ms | 3620 KiB |
s3.txt | AC | 3 ms | 3704 KiB |