QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#99696 | #4807. Melborp Lacissalc | ckiseki# | AC ✓ | 385ms | 4192kb | C++20 | 2.0kb | 2023-04-23 15:12:09 | 2023-04-23 15:12:13 |
Judging History
answer
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define orange(a...) orange_(#a, a)
#define debug(a...) debug_(#a, a)
template <typename i>
void orange_(const char * s, i l, i r) {
cerr << "\e[1;32m[ " << s << " ] = [ ";
for (int f = 0; l != r; l++)
cerr << (f++ ? " " : "") << *l;
cerr << " ]\e[0m\n";
}
template <typename ...T>
void debug_(const char * s, T ...a) {
cerr << "\e[1;32m(" << s << ") = (";
int cnt = sizeof...(T);
(..., (cerr << a << (--cnt ? ", " : ")\e[0m\n")));
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif
const int maxn = 65;
const int mod = 998244353;
int modadd(int a, int b) {
return a + b >= mod ? a + b - mod : a + b;
}
int modmul(int64_t a, int64_t b) {
return static_cast<int>(a * b % mod);
}
int inv[maxn], fac[maxn], ifac[maxn];
int C(int n, int k) {
assert (k >= 0 && k <= n);
return modmul(fac[n], modmul(ifac[k], ifac[n - k]));
}
int c2(int n) {
return n * (n - 1) / 2;
}
int dp[maxn][maxn * maxn];
int main() {
inv[1] = 1;
for (int i = 2; i < maxn; i++)
inv[i] = modmul(inv[mod % i], mod - mod / i);
fac[0] = ifac[0] = 1;
for (int i = 1; i < maxn; i++) {
fac[i] = modmul(fac[i - 1], i);
ifac[i] = modmul(ifac[i - 1], inv[i]);
}
cin.tie(nullptr)->sync_with_stdio(false);
int n, k, t;
cin >> n >> k >> t;
dp[0][0] = 1;
for (int j = 0; j < k; j++) {
for (int i = n; i >= 1; i--) {
for (int sz = 1; sz <= i; sz++) {
const int m = c2(sz) + (j==0 ? sz : 0);
for (int c = m; c <= t; c++) {
dp[i][c] = modadd(
dp[i][c],
modmul( dp[i - sz][c - m] , C(i, sz) )
);
}
}
}
}
cout << dp[n][t] << '\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3328kb
input:
2 5 1
output:
12
result:
ok 1 number(s): "12"
Test #2:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
7 10 15
output:
2016
result:
ok 1 number(s): "2016"
Test #3:
score: 0
Accepted
time: 9ms
memory: 3696kb
input:
46 50 171
output:
645560469
result:
ok 1 number(s): "645560469"
Test #4:
score: 0
Accepted
time: 2ms
memory: 3624kb
input:
64 64 0
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
64 64 1
output:
326126263
result:
ok 1 number(s): "326126263"
Test #6:
score: 0
Accepted
time: 3ms
memory: 3736kb
input:
63 64 0
output:
4476118
result:
ok 1 number(s): "4476118"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
11 45 14
output:
963276342
result:
ok 1 number(s): "963276342"
Test #8:
score: 0
Accepted
time: 12ms
memory: 3528kb
input:
35 20 565
output:
0
result:
ok 1 number(s): "0"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
3 64 5
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 6ms
memory: 3640kb
input:
35 45 153
output:
181934997
result:
ok 1 number(s): "181934997"
Test #11:
score: 0
Accepted
time: 2ms
memory: 3552kb
input:
3 25 5
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 3ms
memory: 3564kb
input:
35 5 373
output:
740122840
result:
ok 1 number(s): "740122840"
Test #13:
score: 0
Accepted
time: 2ms
memory: 3380kb
input:
3 50 5
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 0
Accepted
time: 14ms
memory: 3668kb
input:
35 30 592
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 2ms
memory: 3540kb
input:
3 11 1
output:
540
result:
ok 1 number(s): "540"
Test #16:
score: 0
Accepted
time: 17ms
memory: 3712kb
input:
35 55 352
output:
656633208
result:
ok 1 number(s): "656633208"
Test #17:
score: 0
Accepted
time: 20ms
memory: 3792kb
input:
54 38 356
output:
215089708
result:
ok 1 number(s): "215089708"
Test #18:
score: 0
Accepted
time: 3ms
memory: 3388kb
input:
22 19 189
output:
0
result:
ok 1 number(s): "0"
Test #19:
score: 0
Accepted
time: 38ms
memory: 3648kb
input:
54 63 401
output:
987604839
result:
ok 1 number(s): "987604839"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
22 43 171
output:
827743481
result:
ok 1 number(s): "827743481"
Test #21:
score: 0
Accepted
time: 18ms
memory: 3596kb
input:
54 24 446
output:
551546514
result:
ok 1 number(s): "551546514"
Test #22:
score: 0
Accepted
time: 2ms
memory: 3580kb
input:
22 4 152
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 0
Accepted
time: 129ms
memory: 3932kb
input:
54 48 1306
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 0ms
memory: 3416kb
input:
22 29 7
output:
374430631
result:
ok 1 number(s): "374430631"
Test #25:
score: 0
Accepted
time: 27ms
memory: 3868kb
input:
54 9 1351
output:
0
result:
ok 1 number(s): "0"
Test #26:
score: 0
Accepted
time: 2ms
memory: 3456kb
input:
22 54 5
output:
267958047
result:
ok 1 number(s): "267958047"
Test #27:
score: 0
Accepted
time: 111ms
memory: 3904kb
input:
64 32 1315
output:
494251101
result:
ok 1 number(s): "494251101"
Test #28:
score: 0
Accepted
time: 2ms
memory: 3704kb
input:
33 12 332
output:
765350074
result:
ok 1 number(s): "765350074"
Test #29:
score: 0
Accepted
time: 2ms
memory: 3452kb
input:
1 57 1
output:
1
result:
ok 1 number(s): "1"
Test #30:
score: 0
Accepted
time: 12ms
memory: 3556kb
input:
33 37 363
output:
0
result:
ok 1 number(s): "0"
Test #31:
score: 0
Accepted
time: 2ms
memory: 3428kb
input:
1 17 0
output:
16
result:
ok 1 number(s): "16"
Test #32:
score: 0
Accepted
time: 3ms
memory: 3580kb
input:
33 62 148
output:
871819399
result:
ok 1 number(s): "871819399"
Test #33:
score: 0
Accepted
time: 2ms
memory: 3488kb
input:
1 42 0
output:
41
result:
ok 1 number(s): "41"
Test #34:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
33 23 179
output:
23699248
result:
ok 1 number(s): "23699248"
Test #35:
score: 0
Accepted
time: 0ms
memory: 3328kb
input:
1 3 1
output:
1
result:
ok 1 number(s): "1"
Test #36:
score: 0
Accepted
time: 4ms
memory: 3452kb
input:
33 47 211
output:
267909794
result:
ok 1 number(s): "267909794"
Test #37:
score: 0
Accepted
time: 2ms
memory: 3412kb
input:
11 26 32
output:
0
result:
ok 1 number(s): "0"
Test #38:
score: 0
Accepted
time: 6ms
memory: 3708kb
input:
43 6 579
output:
280289125
result:
ok 1 number(s): "280289125"
Test #39:
score: 0
Accepted
time: 2ms
memory: 3420kb
input:
11 50 5
output:
865381083
result:
ok 1 number(s): "865381083"
Test #40:
score: 0
Accepted
time: 32ms
memory: 3792kb
input:
43 31 750
output:
0
result:
ok 1 number(s): "0"
Test #41:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
11 11 12
output:
753565341
result:
ok 1 number(s): "753565341"
Test #42:
score: 0
Accepted
time: 17ms
memory: 3536kb
input:
43 56 290
output:
575236094
result:
ok 1 number(s): "575236094"
Test #43:
score: 0
Accepted
time: 2ms
memory: 3476kb
input:
11 36 52
output:
0
result:
ok 1 number(s): "0"
Test #44:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
44 16 0
output:
0
result:
ok 1 number(s): "0"
Test #45:
score: 0
Accepted
time: 2ms
memory: 3492kb
input:
12 61 31
output:
682427534
result:
ok 1 number(s): "682427534"
Test #46:
score: 0
Accepted
time: 15ms
memory: 3572kb
input:
44 41 365
output:
759457870
result:
ok 1 number(s): "759457870"
Test #47:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
22 19 70
output:
247296498
result:
ok 1 number(s): "247296498"
Test #48:
score: 0
Accepted
time: 37ms
memory: 3752kb
input:
54 64 444
output:
418216086
result:
ok 1 number(s): "418216086"
Test #49:
score: 0
Accepted
time: 2ms
memory: 3532kb
input:
22 44 52
output:
779702126
result:
ok 1 number(s): "779702126"
Test #50:
score: 0
Accepted
time: 70ms
memory: 3920kb
input:
54 25 1303
output:
0
result:
ok 1 number(s): "0"
Test #51:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
22 5 49
output:
219556981
result:
ok 1 number(s): "219556981"
Test #52:
score: 0
Accepted
time: 128ms
memory: 4012kb
input:
54 49 1269
output:
0
result:
ok 1 number(s): "0"
Test #53:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
22 30 14
output:
719775605
result:
ok 1 number(s): "719775605"
Test #54:
score: 0
Accepted
time: 25ms
memory: 3980kb
input:
54 10 1314
output:
0
result:
ok 1 number(s): "0"
Test #55:
score: 0
Accepted
time: 2ms
memory: 3524kb
input:
22 54 12
output:
325137058
result:
ok 1 number(s): "325137058"
Test #56:
score: 0
Accepted
time: 96ms
memory: 3828kb
input:
54 35 1359
output:
0
result:
ok 1 number(s): "0"
Test #57:
score: 0
Accepted
time: 1ms
memory: 3524kb
input:
33 13 335
output:
202725820
result:
ok 1 number(s): "202725820"
Test #58:
score: 0
Accepted
time: 385ms
memory: 4132kb
input:
64 64 2080
output:
1
result:
ok 1 number(s): "1"
Test #59:
score: 0
Accepted
time: 1ms
memory: 3360kb
input:
1 1 0
output:
0
result:
ok 1 number(s): "0"
Test #60:
score: 0
Accepted
time: 2ms
memory: 3288kb
input:
1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #61:
score: 0
Accepted
time: 364ms
memory: 4192kb
input:
63 63 2016
output:
1
result:
ok 1 number(s): "1"