MikeMirzayanov's blog

By MikeMirzayanov, 10 months ago, translation,

Many thanks to cannor147 and geranazavr555 for the help with the translation into English.

1259A - Happy Birthday, Polycarp!

Problem Writer: MikeMirzayanov

Editorial
1259B - Make Them Odd

Problem Writer: MikeMirzayanov

Editorial
1259C - As Simple as One and Two

Problem Writer: MikeMirzayanov

Editorial
1259D - Let's Play the Words?

Problem Writer: MikeMirzayanov

Editorial
1259E - Two Fairs

Problem Writer: MikeMirzayanov

Editorial
1259F - Beautiful Rectangle

Problem Writer: MikeMirzayanov

Editorial
1259G - Tree Elimination

Problem Writers: Endagorion

Editorial
1276E - Four Stones

Problem Writers: Endagorion

Editorial
1276F - Asterisk Substrings

Problem Writers: voidmax

Editorial
Tutorial of div2 B-C #1

• +50

 » 10 months ago, # | ← Rev. 2 →   +1 I didn't get it in DIV 1 A it is important to delete the middle letters in the last two paragraphs to avoid appearing a new occurrence after a line is collapsed can anyone provide some testcase
•  » » 10 months ago, # ^ | ← Rev. 2 →   +11 For instance: tttwoooneee. If you delete the letter t that is standing before w, after deletion you still get "two".
•  » » » 10 months ago, # ^ |   -9 thanks, i missed that
 » 10 months ago, # | ← Rev. 2 →   0 My solution to Div.2 E :1) Perform DFS starting at Vertex a. This DFS function returns when reached at Vertex b.2) Perform DFS starting at Vertex b. This DFS function returns when reached at Vertex a.3) When each function saves the visited vertex, there is the vertex that only the first function visited, the vertex that only the second function visited, and the vertex at which both functions visited.4) Multiply the number of vertices only the first function visited by the number of vertices only the second function visited, and it's the answer.For example, on this graph, the answer is 5 x 6 = 30.Code : 67127301
•  » » 10 months ago, # ^ |   -7 thanks man, easier than the editorial
•  » » 10 months ago, # ^ |   -13 Do we have to always consider that cities a and b are connected by some road? Can they be diconnected?
•  » » » 10 months ago, # ^ |   -10 The problem specifies "It is guaranteed that from any city you can pass to any other by roads."
•  » » » » 10 months ago, # ^ |   -10 Thanks...
•  » » 10 months ago, # ^ | ← Rev. 2 →   -10 Is the highlighted path valid ? from 2 to A to 1 to B to 3 ?
•  » » » 10 months ago, # ^ |   -7 In your example, the pair (2, 3) will not count towards the solution. The problem states that for a pair (U, V) to count towards the solution, every way to get from city U to city V or from V to U must go through A and B. If there exists a path between them that does NOT go through both A and B, then it does not count towards the solution.In your example, there exists a path from 2 to 3 that does NOT go through A and B, thus it does not count towards the solution.The only "valid" pairs in your example would be (X1, Y) and (X2, Y). Answer = 2;
•  » » » » 10 months ago, # ^ |   +3 Thanks ,understood!
•  » » 4 months ago, # ^ |   0 Thanks man.
 » 10 months ago, # | ← Rev. 2 →   -7 I really liked this contest, I wish I had participated live.Here's my solution for Div2-E using BFS. Uses very similar approach to what is mentioned in the editorial. 66995096
•  » » 10 months ago, # ^ |   -10 I found your solution more intuitive than editorial's solution. Here is DFS based implementation of your idea. 67419480
 » 10 months ago, # |   +4 VERY nice editorial MikeMirzayanov
 » 10 months ago, # |   -10 Could anyone help me to hack this wrong solution?66896686
•  » » 10 months ago, # ^ |   0 input: 1 tttwoooooonneeeee output: 1 3 should be : 1 4
•  » » » 10 months ago, # ^ |   0 Thank you so much.
 » 10 months ago, # |   -10 Div2 D5th paragraph, 1st line "In fact, the set of words of kind n10 has no more than n10"Shouldn't it be "In fact, the set of words of kind n01 has no more than n10"?
 » 10 months ago, # | ← Rev. 2 →   +2 In the editorial for the problem G: In the recursive equation for dp[v][0], the first product should be "j = 1 to i — 1", not "j = 1 to i = 1". In the recursive equation for dp[v][1], the first product should be "j = 1 to d", not "j = 1 to i = d". In the recursive equation for dp[v][2], the first product should be "j = 1 to i — 1", not "j = 1 to i = 1".
•  » » 10 months ago, # ^ | ← Rev. 4 →   0
 » 10 months ago, # |   0 In the problem 1277D - Let's Play the Words?, how come the solution to the last sample testcase is given as 1 2
•  » » 10 months ago, # ^ | ← Rev. 2 →   0 01 -> 10001 -> 100And so:10000110000001
 » 10 months ago, # |   0 can anyone give me a testcase that broke my code?
 » 10 months ago, # |   0 606 Problem D video explanation https://youtu.be/4QeGE1MsviM
 » 9 months ago, # |   0 I have a question about div1 E.How do you perform operations to make $\Delta$ decrease to $\frac{3}{4}\Delta$ for stones located at 0, 1, 99999, 100000 according to your alogrithm?
»
7 months ago, # |
0

HAPPY BIRTHDAY POLYCRAP -> what is wrong in my code can anyone tell please???

int n; cin >> n; int digits = 0, min = INT_MAX;

while (n != 0) {
int d = n%10;
digits++;
if (min > d) min = d;
n = n /10;
}

cout << min + (9*(digits - 1)) << endl;

}

 » 6 months ago, # | ← Rev. 3 →   0 I Problem 1259 -D can anyone explain why the OUTPUT of the following INPUT is 0, not -1? Input: 10 0 11 
 » 6 months ago, # |   +3 In the editorial of question D: Let's Play The Words? Why do we need to reverse $n_{01} - n_{10} - 1$ strings and not $(n_{01} - n_{10}) / 2$. Also, can anyone give hints on how to prove that the problem is equivalent to "the Euler traversal of a directed graph with 2 nodes"? Thanks!
•  » » 6 months ago, # ^ |   0 It's probably a mistake.In the code below you have this:  int ans = max(0, (int(max(s01.size(), s10.size())) - int(min(s01.size(), s10.size()))) / 2); That is equivalent to $(n_{01}-n_{10})/2$.
 » 5 months ago, # |   0 can anyone help me in problem B I am getting WA on tc 2 https://codeforces.com/contest/1277/submission/81699789 thanks
 » 3 months ago, # |   0 In Two Fairs, I am not able to understand what exactly (alpha u ,beta u) represents.Can someone clarify? Any help will be appreciated thanks :)