QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#132283 | #2506. 数列 | Heltion | 5 | 131ms | 3700kb | C++20 | 1.6kb | 2023-07-29 12:50:20 | 2023-07-29 12:50:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
constexpr i64 mod = 998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m, k;
cin >> n >> m >> k;
vector c(n + 1, vector<i64>(n + 1));
for (int i = 0; i <= n; i += 1) {
for (int j = 0; j <= i; j += 1) {
c[i][j] = j ? (c[i - 1][j] + c[i - 1][j - 1]) % mod : 1;
}
}
vector f(n + 1, vector(k + 1, vector<i64>(n)));
f[0][0][0] = 1;
for (int i = 0, vi; i <= m; i += 1) {
cin >> vi;
auto g = f;
i64 pv = 1;
for (int j = 1; j <= n; j += 1) {
pv = pv * vi % mod;
for (int x = 0; x <= n; x += 1) {
for (int y = 0; y <= k; y += 1) {
for (int z = 0; z < n; z += 1) {
int nx = x + j;
int ny = y + (z + j) % 2;
int nz = (z + j) / 2;
if (nx <= n and ny <= k and nz < n) {
g[nx][ny][nz] =
(g[nx][ny][nz] +
f[x][y][z] * c[n - x][j] % mod * pv) %
mod;
}
}
}
}
}
f.swap(g);
}
i64 ans = 0;
for (int i = 0; i <= k; i += 1) {
for (int j = 0; j < n; j += 1) {
if (popcount(unsigned(j)) + i <= k) {
ans += f[n][i][j];
}
}
}
cout << ans % mod;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3460kb
input:
8 9 1 499488183 118995914 332316574 399234563 246850128 338768262 489466833 673193710 723933572 12759125
output:
158287041
result:
wrong answer 1st lines differ - expected: '789420212', found: '158287041'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3536kb
input:
8 9 3 215521602 492908007 261206435 521145497 259750366 553629902 997991039 523071946 767416953 56767036
output:
241386435
result:
wrong answer 1st lines differ - expected: '450775894', found: '241386435'
Test #3:
score: 0
Wrong Answer
time: 1ms
memory: 3476kb
input:
8 9 5 396559700 356016879 796231055 117198018 986043211 5573279 915325714 896890982 238440937 772820521
output:
621032657
result:
wrong answer 1st lines differ - expected: '34463958', found: '621032657'
Test #4:
score: 5
Accepted
time: 1ms
memory: 3484kb
input:
8 9 8 823551883 246279514 512316795 50015811 596048859 634297559 357816173 172030638 277258510 920803140
output:
650836255
result:
ok single line: '650836255'
Test #5:
score: 0
Wrong Answer
time: 4ms
memory: 3632kb
input:
30 7 5 277343567 231557726 518417466 839831772 308153685 661255375 10400942 137452650
output:
566984171
result:
wrong answer 1st lines differ - expected: '570273281', found: '566984171'
Test #6:
score: 0
Wrong Answer
time: 4ms
memory: 3604kb
input:
30 7 6 769481383 218933928 397917786 715817994 28458205 1741468 432666671 767453624
output:
545193660
result:
wrong answer 1st lines differ - expected: '802897416', found: '545193660'
Test #7:
score: 0
Wrong Answer
time: 6ms
memory: 3584kb
input:
30 7 9 560097542 225678652 985380091 657360686 588960965 286023927 39451645 813153395
output:
751329511
result:
wrong answer 1st lines differ - expected: '200784526', found: '751329511'
Test #8:
score: 0
Wrong Answer
time: 7ms
memory: 3672kb
input:
30 12 7 233649570 882345965 363522936 697518226 276565878 305171861 862016201 694650802 295202855 895115917 87982489 198145962 118457524
output:
849791466
result:
wrong answer 1st lines differ - expected: '191413880', found: '849791466'
Test #9:
score: 0
Wrong Answer
time: 8ms
memory: 3672kb
input:
30 12 8 280972635 121394003 96961086 311593799 16824904 872035232 806270513 706873478 838387709 911762507 518375946 363189973 93846934
output:
759841985
result:
wrong answer 1st lines differ - expected: '878193241', found: '759841985'
Test #10:
score: 0
Wrong Answer
time: 12ms
memory: 3620kb
input:
30 12 14 33118764 570808334 277911327 206225040 739764940 873120222 787166401 297143172 542645907 209959496 558572198 749568456 492469905
output:
259357861
result:
wrong answer 1st lines differ - expected: '8638776', found: '259357861'
Test #11:
score: 0
Wrong Answer
time: 11ms
memory: 3540kb
input:
30 100 1 280989359 685610909 652483091 218262426 612187297 933993851 128465889 118119862 758459128 482869427 840417548 996214463 836110953 8956015 894945622 619560556 219818505 29451496 358272495 696206257 230342287 851588985 859573270 833968093 763204877 853785448 282969832 273841812 923102044 4584...
output:
979070963
result:
wrong answer 1st lines differ - expected: '918455864', found: '979070963'
Test #12:
score: 0
Wrong Answer
time: 11ms
memory: 3516kb
input:
30 100 1 238187011 269812145 373797704 493559311 525459197 494840062 127348462 781447685 540053429 448451906 15397875 202443100 38732140 40023578 278484005 462334159 562679988 736926803 282626752 723781472 662277299 358863810 27984540 832197799 962665975 699557436 986649610 436908753 320494341 95769...
output:
97899690
result:
wrong answer 1st lines differ - expected: '524381135', found: '97899690'
Test #13:
score: 0
Wrong Answer
time: 11ms
memory: 3540kb
input:
30 100 1 624756242 578099224 322063599 955163372 527409783 886224870 196768173 678404094 71254380 400463809 462704961 522697398 174568824 839996207 181664607 564129436 324853491 954240664 279841814 134343701 734819121 855324702 517923195 647253253 321867400 801360468 25886504 866237487 301424065 286...
output:
650164120
result:
wrong answer 1st lines differ - expected: '483241545', found: '650164120'
Test #14:
score: 0
Wrong Answer
time: 1ms
memory: 3520kb
input:
5 50 2 254286688 725442098 427960764 796779405 986706963 905854411 818897107 964334286 867743930 583810772 621078041 875275863 94943935 993613474 699229610 139437533 160785883 74877034 8820884 154629232 776225564 385632450 792900606 570001565 857615216 758514611 34346579 426872784 329305393 59552423...
output:
208247186
result:
wrong answer 1st lines differ - expected: '816583992', found: '208247186'
Test #15:
score: 0
Wrong Answer
time: 0ms
memory: 3460kb
input:
5 50 3 398838269 62831191 767680179 548733975 555826543 359315797 126732814 236236917 736299966 477904769 853166426 287461631 463135258 178798437 997403650 87158184 572906600 697966474 960138109 242347816 879956491 777432793 390570007 708647774 714109560 612901589 377307686 585724634 560144176 50107...
output:
749676163
result:
wrong answer 1st lines differ - expected: '937159818', found: '749676163'
Test #16:
score: 0
Wrong Answer
time: 8ms
memory: 3500kb
input:
15 100 8 537276628 100186052 185892981 934916070 567805882 918515644 431750302 796355931 218646822 867528879 340335349 895838502 324783806 28262471 36921137 16069248 30657555 649491332 119673208 552651140 623025591 114876021 403198375 59453768 518635907 617927870 217741861 573018213 950960313 720041...
output:
711200644
result:
wrong answer 1st lines differ - expected: '272087880', found: '711200644'
Test #17:
score: 0
Wrong Answer
time: 30ms
memory: 3660kb
input:
30 30 15 60466183 610467381 171141086 693914857 963904829 564659588 530320949 440079007 365069705 829699120 283564411 328402092 300168872 613261423 746486046 10288211 360128573 745361137 454560349 807372883 536663856 136356261 883801886 164316038 21520306 943453842 666136933 543391844 857298855 3384...
output:
885514699
result:
wrong answer 1st lines differ - expected: '72174927', found: '885514699'
Test #18:
score: 0
Wrong Answer
time: 52ms
memory: 3700kb
input:
30 30 27 791704008 141733617 624846593 851709929 992710617 212811783 633109877 793261502 936354310 396919562 836912348 231815656 963288997 740034788 423011666 759150033 384434935 683576701 853721112 420009380 582576185 749031968 9524373 451203892 109835437 775487403 621839989 303055045 36699775 3463...
output:
564706591
result:
wrong answer 1st lines differ - expected: '253611021', found: '564706591'
Test #19:
score: 0
Wrong Answer
time: 100ms
memory: 3696kb
input:
30 100 16 875698537 331313447 201148316 859357152 75556427 84009302 29165462 183164679 801095477 362574916 174220357 904633392 840544725 26263814 209015337 148424354 181158359 130045322 130726397 756114144 893268484 890267565 401189740 163241681 937879687 734913073 137564816 583877304 334189462 8327...
output:
641965386
result:
wrong answer 1st lines differ - expected: '221099086', found: '641965386'
Test #20:
score: 0
Wrong Answer
time: 131ms
memory: 3640kb
input:
30 100 21 316605536 504649194 334973924 478542137 897005201 967219463 982199815 294027518 578515247 444956501 169932813 517443072 608712080 853574514 517686368 318771389 413578320 648466530 224572747 536246850 615211381 271710227 740813454 795114103 726388592 324201075 793546883 933899825 539137621 ...
output:
918179453
result:
wrong answer 1st lines differ - expected: '483943039', found: '918179453'