NPCAPC user editorial (partially)

Правка en3, от NeoYL, 2024-06-24 06:10:03

If you haven't tried the NPCAPC contest before and you want to do some kind of virtual participation, this editorial is not for you. I do not intend to spoil the questions and the contest experience.

C: Solve with Friends
L: Construction of Town
M: Admired Person

B: Some Sum of Subset

For each layer of DP, you can calculate the values that contribute to the answer with the respective k. First, consider only transferring those that only add A[i] to transfer (those that use A[i]), and also make sure that you perform min(M, sum) to make sure there is no overflow. Then the answer for each k is dp[i][M] * C(N — i, k). This is because we can choose an index afterwards and it does not change the outcome. Remember to add the dp values from the previous layer too after the calculations.

H: Music Game

A: Welcome to NPCAPC

In this case, we know the specific states that we want to go to (using the encoding 7 * i + j). Then we want to deduct it from the number of alphabets that we can use and does not affect our answer (52 initially).

In my code, I precomputed the matrices and stored them inside an array so that I didn't have to waste extra time.

I: Left Equals Right

After finding the sum, let S = sum / 2. Then we can utilize a dp with the states defined as dp[i][j][k] = number of ways that we can have after considering i numbers in the list, gotten j indices, and sum = k. dp[i][j][k] = dp[i — 1][j][k] + dp[i — 1][j — 1][k — A[i]]. When we don't perform anything we automatically transfer the dp[i — 1][j][k] from the previous layer. If we take A[i], that means that we must come from the previous layer, taken j — 1, and previous sum = k — A[i]. Make sure no out-of-bounds is performed in the code.

Then the answer is simply the sum of dp[N][i][S] * (i!) * (N — i)!

K: Peace with Magic

D: Two Box

Теги npcapc, editorial

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en12 Английский NeoYL 2024-11-03 18:38:50 156
en11 Английский NeoYL 2024-11-03 18:32:48 4 Tiny change: 'rsal Cup. \n\nIf you hav' -> 'rsal Cup. If you hav'
en10 Английский NeoYL 2024-06-24 08:37:08 81
en9 Английский NeoYL 2024-06-24 08:35:12 54 Tiny change: 'If you hav' -> 'Do not look at this blog if you are part of the UCUP. If you hav' (published)
en8 Английский NeoYL 2024-06-24 08:31:24 0 Tiny change: 'ience.\n\n<spoil' -> 'ience.\n\nIf you are in \n\n<spoil'
en7 Английский NeoYL 2024-06-24 08:31:23 0 Tiny change: 'ience.\n\n<spoil' -> 'ience.\n\nIf you are in \n\n<spoil' (saved to drafts)
en6 Английский NeoYL 2024-06-24 06:20:44 1 (published)
en5 Английский NeoYL 2024-06-24 06:11:58 0 Tiny change: 'ions.\n\n<spoil' -> 'ions.\n\n</spoiler>\n\n<spoil'
en4 Английский NeoYL 2024-06-24 06:11:00 15 Tiny change: 'ions.\n\n<spoil' -> 'ions.\n\n</spoiler>\n\n<spoil'
en3 Английский NeoYL 2024-06-24 06:10:03 96
en2 Английский NeoYL 2024-06-24 05:38:36 198
en1 Английский NeoYL 2024-06-24 05:33:36 5161 Initial revision (saved to drafts)