By Vladosiya, history, 9 months ago, translation,

1729A - Two Elevators

Tutorial
Solution

1729B - Decode String

Idea: MikeMirzayanov

Tutorial
Solution

1729C - Jumping on Tiles

Idea: MikeMirzayanov, Aris

Tutorial
Solution

1729D - Friends and the Restaurant

Idea: MikeMirzayanov, Aris, myav

Tutorial
Solution

1729E - Guess the Cycle Size

Idea: Gornak40, MikeMirzayanov

Tutorial
Solution

1729F - Kirei and the Linear Function

Idea: Gornak40

Tutorial
Solution

1729G - Cut Substrings

Tutorial
Solution
• +50

 » 9 months ago, # |   0 Can someone breif me the logic or approach of F??
•  » » 9 months ago, # ^ | ← Rev. 2 →   +1 the value of v(l,r)%9 for anly l,r can be found using string hashing. Now for each l,r query we need to find v(L1,L1+w-1) and v(L2,L2+w-1) but since we need mod 9 hence in total there will be 9 possible valus for each thus in total we can 81 combinations now for each combination check if the condition given is true or not if it is then push the value {L1,L2} in a vector then return the smallest value in the vector.Code with comments if u have any doubt do let me know.:)
•  » » » 9 months ago, # ^ |   0 Great solution, you can also use a tip which can make the code easier. For any number, if the sum of all digits is divisible by 9, then that number is divisible by 9. It works simillar if you want to calculate the remainder. For example: 1233: 1 + 2 + 3 + 3 = 9, and 1233 / 9 = 137. Therefore, you can do the operation using prefix sum. (This operation is also available when dividing by 3)
•  » » » » 9 months ago, # ^ |   0 Nice will try it for sure.Thanks for sharing.
•  » » » » 9 months ago, # ^ |   0 this is only true for 3 or 9?
•  » » » » » 9 months ago, # ^ |   0 Yes. For other single digits, there are other ways to check, but those methods are too inefficient to calculate.
 » 9 months ago, # |   +7 finally!
 » 9 months ago, # |   +1 can anyone explain the approach of G?? as here the logic was like brute the entire string(smaller one) with it's repetitions in the larger one , but how is the code checking the optimal removal part? also if there is any topic required as a prerequisite in Dp feel free to suggest.
 » 9 months ago, # |   0 Why isn't this blog put in the contest materials?
 » 9 months ago, # |   0 Problem E is like if u can't find an optimal solution, use brute force such that it does not give a TLE or go beyond the constraints. We can thereafter prove that our solution is correct at one point because all the other attempts failed and hence we have a higher Probability. So we are correct! I have learned a new technique and wondered if probability can even be used like this. kudos to the problem setter.
•  » » 5 months ago, # ^ | ← Rev. 6 →   0 +1. I use binary search ->TLE then tannery search still TLE. Still unable to get the intuition, but still, I find something new to learn. Can you explain the probability concept of the question? (Weak in maths)
•  » » » 5 months ago, # ^ |   0 learn about Randomization. here we the probability of getting different paths increases with number of queries. Let's say probability of getting same paths length is 1/2 in 1st attempt so probability of getting same path length again will be 1/2*1/2 = 1/4 and so on so in about 25 attempts it will be (1/2)^25 which is very low so if we do the operations many time the probability of getting different path is very high. It's close to 99.9999%.
 » 9 months ago, # |   0 Code for F is broken, likely because - is automatically converted to — and then to &mdash
•  » » 9 months ago, # ^ | ← Rev. 2 →   0 That is probably just some dumb html problem
 » 9 months ago, # |   +4 In D, answer will be 0 and not -1 when no groups can be formed.
•  » » 9 months ago, # ^ |   0 Good catch!
 » 9 months ago, # | ← Rev. 2 →   +4 Can anyone suggest similar problems to E for practice
•  » » 9 months ago, # ^ |   +3 According to me, this type of problem is not that much productive to solve, instead understanding how probability played a major role in the solution is enough. You can try some interactive problems whose acceptance is completely in your control(not probability) and they are much fun, like this one1698D.During the contest, at very start I thought to use binary search, but for the worst case number of query will be Log(10^18)base2, which is something 54-55, then it was obvious for me to try something else and after some tries I figured how to go for the solution, but to be honest, I was ready for a TLE or WA after I'd submitted the solution with probability (1-1/(2^25)), BCZ I'm not that lucky :)
•  » » 9 months ago, # ^ | ← Rev. 2 →   +5 This is a nice problem that uses probability like problem E 843B - Interactive LowerBound
•  » » 7 months ago, # ^ |   0 1743D - Problem with Random Tests This is not an interactive problem. But its quite similar because of random testCases
 » 9 months ago, # |   +1 For Problem C:We don't need to iterate to find cost. cost = Math.abs(s[0] - s[n - 1])
 » 9 months ago, # |   +1 Very good contest i love all the problem specially E
 » 9 months ago, # |   +18 There is a small error in E. The probability is slightly smaller than 1/2, since both paths have the same length when dist(x, y) = n/2-1. Which means fixing x and changing only y will give a better probability than changing x and y simultaneously (but still a little worse than 1-2^-25).
 » 9 months ago, # |   0 For problem E it was not very clear from the statement whether interactor assigns answers randomly for ordered pairs (a, b) or not. It could have assigned randomly for each unordered pair, but within same pair (a, b) and (b, a) would not have had 0.5 probability. If that was the case, we would need some other solution.I've managed to get AC with something like: make first 10 queries to get a rough estimate what n / 2 could not exceed. then at each step pick three random vertices a, b, c and query $q1 = (a, b), q2 = (b, c), q3 = (c, a)$. Then, $q1 + q2 + q3 = n$, or $q1 + q2 + q3 = 2 * n$, or $q1 + q2 - q3 = n$, etc. But we skip if $q_i + q_j = q_k$ (even if $q1+q2+q3 = n$ for this case). Having collected some statistics on the values above among 40 left queries we can also end up with AC. I don't have formal formulae with probabilities, but at each not skipped step of that algorithm we always contribute one to the answer in our statistic we're collecting, but may also contribute to some garbage values. My guess was that we contribute to garbage less. :)
 » 9 months ago, # |   +1 Can anyone please explain approach for G, I am able to find the minimum lenght greedily. Facing difficulties in finding the number.Thank you in advance for helping
 » 9 months ago, # |   -9 We can solve E using binary search. Ln(10^18) ~ 41 or 43 (don’t remember). Use request ? 1 mid, and if answer != -1 then l = mid, else r = mid
•  » » 9 months ago, # ^ |   0 it would take log2(10e18) queries not Ln(10e18) which exceeds 50
•  » » » 9 months ago, # ^ |   0 Aaaa, i forgot that it log2, not loge. Then yes, incorrect solve
 » 9 months ago, # |   0 For problem C, I think there's no need to iterate and calculate the cost. It would be just absolute difference of FIRST and LAST letters.
•  » » 9 months ago, # ^ |   0 Yes, but I think we have to iterate to find the path.
 » 9 months ago, # | ← Rev. 3 →   +1 In problem D if no pairs could be formed the answer is obviously 0, not -1.
•  » » 9 months ago, # ^ |   0 lazy_loop wrote this already.
 » 9 months ago, # |   0 Editorial of editorial of G please.
•  » » 9 months ago, # ^ | ← Rev. 5 →   +7 Notice that we need to maximise the size of the Final string , considering that size of character . is 0. Using KMP or String Hashing Algorithm or any other algorithm find out the indexes K, such that s[K-m+1.....K]=t[0....m] , where $m$ is the size of string $t$ and push them into vector named $ind$ Now make a 2D DP , where DP[i][j] representing number of ways to make prefix of string $s$ of size $i$ equal to string of size $j$ , assuming that . size is 0. Now if index $i$ does not lie in $ind$, DP[i][j] would be dp[i-1][j-1] , i.e. we take the i'th element of string $s$ and add it to the final string. Else we can take the sum of DP[K-m][j-(i-K)] such that K>i-m and K<=i , where K are the elements in vector $ind$. K-m represents that all characters of s[K-m+1.....K]='.' , and we substract (i-K) from j because we have already taken all characters in s[K+1.....i] Let me know if some part is unclear.
•  » » » 9 months ago, # ^ |   0 I came up with a 1D dp solution eventually. Your answer inspired me quite a lot, thank you.
•  » » » 9 months ago, # ^ |   0 If index i doesn't lie in the ind, shouldn't dp[i][j] be equal to dp[i-1][j-1], as dp denotes the number of ways?
•  » » » » 9 months ago, # ^ |   +1 Yes , you are right . Edited :)
 » 9 months ago, # |   0 can someone share their approach/code for prob. C in java? Mine's failing for some test cases, can't figure out why
 » 9 months ago, # |   +1 I don't understand why is E rated 1800? In full honesty, the solution seems so ridiculously easy to come up with. After I thought about it during upsolving, I thought it was so simple that something had to be wrong. After checking the editorial, turns out, nothing was wrong. You really did just have to query pairs a b and b a until you get two different responses.
 » 9 months ago, # | ← Rev. 2 →   0 in problem D , why pair is used?
 » 9 months ago, # |   0 can anyone help why I am getting run time error on test 7 here in problem Fhttps://codeforces.com/contest/1729/submission/172335851
•  » » 9 months ago, # ^ | ← Rev. 2 →   0 The number represented in string could be way larger than any build-in type. It's obvious that your convert function can only handle 32-bit integer. Btw I think convert string to integer is not the intention of this problem.
•  » » » 9 months ago, # ^ |   0 Ah thanks, misread the constraints, I thought l, r were such that the length doesn't exceed 8
 » 9 months ago, # |   0 In problem E, had it been 60 queries, then we could have find the size of graph by simply applying binary search, right?
•  » » 9 months ago, # ^ |   0 yep
 » 9 months ago, # |   0 I would like to ask what is the function of this sentence (p[++tot]=n+m;) in the standard code given by the questioner of G question? thanks
 » 9 months ago, # |   0 Can someone give me a hint on problem D?Thanks in advance.
•  » » 9 months ago, # ^ |   0 It's more optimal to have groups consisting in only two people.
•  » » » 9 months ago, # ^ |   0 Thank you :)
 » 9 months ago, # |   0 What is the test case 3 of Problem C? I can't understand which case I have missed in my solution here. Is there any constraint in the sequence of path? Does the path have to match exactly as mentioned in the test cases?
•  » » 9 months ago, # ^ |   0 Take a look at Ticket 16197 from CF Stress for a counter example.
•  » » » 9 months ago, # ^ |   0 Double thanks for the reference to the awesome tool and also the failing test case. I had to use stable_sort() in my logic.
 » 9 months ago, # |   0 Code chhapne pe idleness limit exceeded nhi aayi, but same code khud krne se aagyi. (Translation: Copying code didn't give idleness limit exceeded, while writing the same code did. Submissions: https://codeforces.com/contest/1729/submission/173058013 https://codeforces.com/contest/1729/submission/173057953 ) Someone comment pls :(
 » 9 months ago, # | ← Rev. 2 →   0 how can we detect the minimum possible accurate number of guesses in problem E ?
 » 9 months ago, # |   0 please can someone explains the detailed solution for problem G, I can't understand tutorial.
 » 8 months ago, # |   0 https://codeforces.com/contest/1729/submission/174301987can someone explain what's wrong with my code here?
•  » » 8 months ago, # ^ |   0 Take a look at Ticket 16234 from CF Stress for a counter example.