QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#343307#8276. Code Congestionmendicillin2#WA 92ms7748kbC++141.3kb2024-03-02 13:43:332024-03-02 13:43:33

Judging History

你现在查看的是最新测评结果

  • [2024-03-02 13:43:33]
  • 评测
  • 测评结果:WA
  • 用时:92ms
  • 内存:7748kb
  • [2024-03-02 13:43:33]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int INF = 998244353;
const int maxn = 205;
const int maxT = 1e5 + 5; 

int n, T;
int a[maxn], b[maxn];
int f[maxn][maxT][2], g[maxn][maxT][2];

inline void uadd(int &x, const int &y){ (x += y); x -= (x >= INF ? INF : 0); }

int main(){
	scanf("%d%d", &n, &T);
	for(int i = 0; i < n; ++i) scanf("%d", b + i);
	for(int i = 0; i < n; ++i) scanf("%d", a + i);
	
	// as visible problem
	f[0][0][0] = 1;
	for(int i = 0; i < n; ++i) for(int j = 0; j <= T; ++j){
		if(f[i][j][0]){
			if(j + a[i] <= T) uadd(f[i + 1][j + a[i]][0], f[i][j][0]);
			uadd(f[i + 1][j][0], f[i][j][0]);
			if(j + a[i] <= T) uadd(f[i + 1][j + a[i]][1], 1ll * f[i][j][0] * b[i] % INF);
		}
		if(f[i][j][1]){
			uadd(f[i + 1][j][1], (f[i][j][1] + f[i][j][1]) % INF);
		}
	}
	// as invisible problem
	g[0][0][0] = 1;
	for(int i = 0; i < n; ++i) for(int j = 0; j <= T; ++j){
		if(g[i][j][0]){
			uadd(g[i + 1][j + a[i]][0], (g[i][j][0] + g[i][j][0]) % INF);
			uadd(g[i + 1][j + a[i]][1], 1ll * g[i][j][0] * b[i] % INF);
		}
		if(g[i][j][1]){
			uadd(g[i + 1][j + a[i]][1], g[i][j][1]);
			uadd(g[i + 1][j][1], g[i][j][1]);
		}
	}
	
	int ans = 0;
	for(int j = 0; j <= T; ++j) uadd(ans, g[n][j][1]), uadd(ans, f[n][j][1]);
	printf("%d\n", ans);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 5880kb

input:

3 3
2 3 4
1 2 2

output:

40

result:

ok 1 number(s): "40"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5940kb

input:

13 96
56231 258305 150103 164646 232643 37457 239584 192517 167805 215281 159832 98020 141006
54 1 38 1 4 1 4 11 1 4 8 22 1

output:

745634757

result:

ok 1 number(s): "745634757"

Test #3:

score: 0
Accepted
time: 1ms
memory: 6080kb

input:

14 86
205026 38691 58462 59767 205360 152715 7879 105238 33507 280429 54906 248241 102327 202931
1 49 1 1 5 12 1 5 9 18 1 1 3 32

output:

310231569

result:

ok 1 number(s): "310231569"

Test #4:

score: 0
Accepted
time: 1ms
memory: 5920kb

input:

14 85
82111 267744 229782 32542 260127 152775 1364 293699 23965 242667 264864 219673 189482 12945
1 5 1 1 2 1 38 14 1 3 4 1 21 53

output:

745175834

result:

ok 1 number(s): "745175834"

Test #5:

score: 0
Accepted
time: 1ms
memory: 5920kb

input:

15 94
119505 80865 95965 30047 68261 120903 113180 192738 220899 279742 32609 275645 38640 213859 282516
1 1 8 15 1 3 1 38 6 1 23 57 1 5 79

output:

970187257

result:

ok 1 number(s): "970187257"

Test #6:

score: 0
Accepted
time: 0ms
memory: 7732kb

input:

200 91
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

602403195

result:

ok 1 number(s): "602403195"

Test #7:

score: 0
Accepted
time: 3ms
memory: 7724kb

input:

198 87
276373 259622 211541 127475 41483 45243 254828 92569 120672 280027 180073 248960 25052 110553 136460 102137 166179 165627 29260 33966 121236 34304 67399 250912 104260 114026 261774 159285 218100 110269 112808 224799 170009 150816 34232 290942 52872 176861 177679 36123 92008 39070 265659 25497...

output:

605480487

result:

ok 1 number(s): "605480487"

Test #8:

score: -100
Wrong Answer
time: 92ms
memory: 7748kb

input:

198 234111
89712 73706 49851 196942 284937 252036 155683 1073 160017 24302 1736 21240 97245 116054 17583 258181 102901 54151 14410 251885 121370 135369 278761 195054 259593 292654 222660 193579 111738 119045 14083 214343 1531 298888 25144 88309 170939 62023 113276 169190 31076 65869 121858 158901 89...

output:

390883784

result:

wrong answer 1st numbers differ - expected: '762578553', found: '390883784'