Educational Codeforces Round 136 Editorial
source link: https://codeforces.com/blog/entry/107461?f0a28=1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
2 months ago, # | can anyone help me in D 174113824 |
-
Take a look at Ticket 16232 from CF Stress for a counter example.
2 months ago, # | Can someone suggest problems similar to Div2 C: Card Game, which requires DP, Combinatorics and some thinking. Thanks! |
For those who just want to see the recurrence used in solution for C: Let represent some player, and represent the opponent of that player. |
2 months ago, # | When does the robot break? Let the robot currently be in the cell (j,i) (0-indexed) and the next column with a dirty cell be nxti (possibly, nxti=i). The robot breaks only if both (1−j,nxti) and (j,nxti) are dirty. I think there is a typo. break condition should be (1-j,nxti) and (j,nxti + 1) |
My solution to Prblem C in Div 2. This is very interesting. We can find that:
So we have . There is another key to the task : the number of way to make a draw is equal to . So . My submission : 174191151 |
-
_ So the number of ways that Alice wins is equal to the number of ways that Boris wins with n−2 cards_ i dont understand this part, can you explain how you get to that observaton ?
-
Because in the first round, Boris is Stronger and plays cards first in the second round. (This is because Boris has got the biggest card). If Boris loses the round with card, then Alise will win in the round with cards. For example.
Alice :
Boris :
Alice uses card and Boris uses card , then Alice has card and Boris has card . in this case ( cards in total) Alice will win in the game ( cards in total).
-
7 weeks ago, # | In D, why does this greedy solution starting from the root and cutting whenever the depth exceeds the candidate does not work? TIA |
-
Consider the following input
Input:
Output:
2
If you cut the tree whenever depth exceeds 2, you will require 2 operations, while the min. operations to make depth 2 is actually 1. Just make the tree and see why this happening :)
7 weeks ago, # | Why are the constraints so low for C? |
7 weeks ago, # | Someone please help with my solution to problem E: https://codeforces.com/contest/1739/submission/174503555 idea: dp[i][j][k] ; 0<=i<=1, 0<=j<=n-1, 0<=k<=2 dp[i][j][0] = num cells to clean manually in [0-1][j..n-1] rectangle if we are currently at clean (i,j) dp[i][j][1] = num cells to clean manually in [0-1][j..n-1] rectangle if we are currently at clean (i,j), and cell (1-i,j) is already clean dp[i][j][2] = num cells to clean manually in [0-1][j..n-1] rectangle if we are currently at clean (i,j), and cells (1-i,j) and (1-i,j+1) are already clean I store the index of next clean cell in row i in k00,k01,k02; and of row 1-i in k10,k11,k12 |
7 weeks ago, # | For problem E: " When does the robot break? Let the robot currently be in the cell (0-indexed) and the next column with a dirty cell be (possibly, ). The robot breaks only if both and are dirty " Shouldn't it break when and are both dirty, and is clean ? |
7 weeks ago, # | BledDest!
As I see, you don't use this links or |
-
Yeah,
ncost
does the trick. Usually the exit links are helpful to traverse the whole path to the root along the suffix links without actually visiting non-terminal states of the Aho-Corasick (for example, this allows to find all occurrences of all strings we have to search for in ); but in this problem, we are not interested in the actual occurrences themselves, only in their total cost, so precalculating it for each state is both easier and faster.
7 weeks ago, # | Can somebody explain problem E why it is not always optimal when the robot is at j-th row i-th column and is dirty, is clean, and we just always go to clean ? I have been stuck by this for a long time but could not find any counter case :/ |
-
See this case:
8 00100110 10001101
You can see that if you clean the cell in (1, 3) (1-indexed, (row, col)) you will avoid doing some forced cleaning twice near the end.
If you are doing DP, probably you just need to add one more transition to take care of this.
7 weeks ago, # | can anyone tell what is the turn variable used for in Div2 C: Card Game solution 1 |
5 weeks ago, # | |
-
Take a look at Ticket 16324 from CF Stress for a counter example.
BledDest Problem C-Card Game (Did you converted combination recurrence relation of solution 2 to bottom up dp in solution 1. How did you exactly come up with Solution 1.)
Please could you give some recurrence relation to understand DP one more thing to notice it is mentioned t=0 means draw but t=2 is draw in Solution1.
|
2 hours ago, # | Reverse everything and make a problem and throw at our face. |
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK