#P10143. [WC2024] 代码堵塞

[WC2024] 代码堵塞

Problem Description

To commemorate the discontinued Code Jam, Little \beth is preparing a “Code Blockage Memorial Contest”. Little \beth's friend Little \mho also comes to watch, so Little \beth wants to predict Little \mho's result.

The contest lasts TT seconds and has nn problems. The score of problem i(1in)i(1 \le i \le n) is aia_i, and Little \beth predicts that Little \mho needs tit_i seconds to finish it.

There are two types of problems: visible-result and invisible-result. For an invisible-result problem, you can only know the judging result after the contest ends, while for a visible-result problem, you get the judging result immediately after submission. Little \beth has not yet decided the type of each problem.

Since Little \mho never writes a checker for stress testing, they will first finish all visible-result problems in increasing order of index, and then finish all invisible-result problems in increasing order of index. Little \mho will spend tit_i seconds to finish problem ii. If the total time spent on problem ii and all problems finished before it is not greater than TT, then Little \mho will make a submission on problem ii.

Since every submission by Little \mho is accepted (AC), Little \beth wants to know, over all 2n2^n ways to determine the types of the nn problems, the sum of the total scores that Little \mho can get. Since the answer can be very large, output it modulo 998244353998244353.

Input Format

The first line contains three integers c,n,Tc, n, T, representing the test point index, the number of problems, and the contest duration. In the sample, cc indicates that it satisfies the same constraints as test point cc.

The second line contains nn integers a1,a2,,ana_1, a_2, \cdots , a_n, representing the score of each problem.

The third line contains nn integers t1,t2,,tnt_1, t_2, \cdots , t_n, representing the time Little \mho needs for each problem.

Output Format

Output one integer, representing, over all ways to determine the problem types, the sum of the total scores Little \mho can obtain, modulo 998244353998244353.

1 3 3
2 3 4
1 2 2
40

Hint

Sample 1 Explanation

We use a 0101 sequence of length 33 to represent the problem types, where 11 means visible-result and 00 means invisible-result.

  • (0,0,0)(1,0,0)(1,1,0)(1,1,1)(0, 0, 0)(1, 0, 0)(1, 1, 0)(1, 1, 1): in these four cases, Little \mho solves problems in increasing order of index, submissions are made on the first two problems, and the score sum is 55.
  • (0,1,0)(0, 1, 0): Little \mho solves in the order 213213, submissions are made on the first two solved problems, and the score sum is 55.
  • (0,0,1)(0, 0, 1): Little \mho solves in the order 312312, submissions are made on the first and third problems, and the score sum is 66.
  • (1,0,1)(1, 0, 1): Little \mho solves in the order 132132, submissions are made on the first and third problems, and the score sum is 66.
  • (0,1,1)(0, 1, 1): Little \mho solves in the order 231231, only the second problem has a submission, and the score sum is 33.

Therefore, the answer is (5×4+5+6+6+3)mod998244353=40(5 \times 4 + 5 + 6 + 6 + 3) \bmod 998244353 = 40.

Constraints

For all testdata:

  • 1n2001\le n\le 200.
  • 1T3×1051\le T\le 3\times 10^5.
  • 1in,1ai3×105\forall 1\le i\le n , 1\le a_i\le 3\times 10^5.
  • 1in,1tiT\forall 1\le i\le n, 1\le t_i\le T.
Test Point Index nn\le TT\le Special Property A Special Property B
141\sim 4 1515 10210^2 No
575\sim 7 200200 3×1053\times 10^5 Yes Yes
8,98,9 No
101310\sim 13 No Yes
141614\sim 16 5050 10310^3 No
17,1817,18 10210^2 10410^4
19,2019,20 200200 3×1053\times 10^5
  • Special Property A: 1in,ai=1\forall 1 \le i \le n, a_i = 1.
  • Special Property B: 1in,ti=1\forall 1 \le i \le n, t_i = 1.

Afterword

“Why are all problems in your contest invisible-result?”

Translated by ChatGPT 5