### xyz2606's blog

By xyz2606, 16 months ago,

• +113

 » 16 months ago, # |   +19 Auto comment: topic has been updated by xyz2606 (previous revision, new revision, compare).
 » 16 months ago, # |   -88 constructiveforces
 » 16 months ago, # |   +15 Can you also provide codes for the above editorials?
 » 16 months ago, # |   -11 Problem D: If we use dynamic programming to compute the shortest path from u with length k how can we be sure that we will come back to u after k steps?
•  » » 16 months ago, # ^ |   +4 find the shortest path upto k/2 moves and then come back along the same path...
•  » » » 16 months ago, # ^ |   0 I did the same thing still get wa on test 4 :(
•  » » » 16 months ago, # ^ | ← Rev. 2 →   +5 solved
•  » » » » 16 months ago, # ^ |   0 what was the problem in the 4th test? Do you have a test case?
•  » » » » » 16 months ago, # ^ |   0 Basically I was miscalculating the edge cost from going right to left and down to up. But somehow that buggy code passed the first 3 test cases and not the 4th one
•  » » » » » 16 months ago, # ^ |   0 Did you find your bug ! I've implemented the solution explained in the editorial , still somehow getting WA on test 4 . 114377482
•  » » » » » » 16 months ago, # ^ |   0 yes. I used m instead of n somewhere. I think you should just reread your code. Its not some special testcase apparently
•  » » » » » » » 16 months ago, # ^ |   0 Yeah , I did the same mistake . Now solved
•  » » 16 months ago, # ^ | ← Rev. 2 →   +2 When k is even, we need to find the shortest path from starting position by performing only k/2 steps. And then traverse back along this path to get the required answer for k steps.
•  » » 16 months ago, # ^ |   0 The shortest path is not with length k, but with length i. If k/i is even, we can go this path from start to end and then from end to start all the time. So finally we can return u.
•  » » » 16 months ago, # ^ |   0 Sorry I dont get what you meant by i
•  » » » » 16 months ago, # ^ |   0 It can be a divisor of k, we can enumerate it.
•  » » » » » 16 months ago, # ^ |   0 My bad I missed that part on contest, thanks btw
•  » » » » » 16 months ago, # ^ | ← Rev. 3 →   0 solved
 » 16 months ago, # |   0 Today's most of the questions was based on matrix
 » 16 months ago, # | ← Rev. 2 →   -7 Was able to solve 3 in a Div1+Div2 chinese round yay!
 » 16 months ago, # | ← Rev. 6 →   0 Can someone help me with thisAccording to what i searched this error means that comparator is broken but i tried my best to include all possibilities in comparator can somebody please help me out in this Language java Problem B Code https://codeforces.com/contest/1517/submission/114037412
•  » » 16 months ago, # ^ |   +4 Hey, your comparator isn't defining the equality condition, when will two pairs be equal? Try changing line 157 from "return 1;" to "return 0;", it will work :)
•  » » 16 months ago, # ^ |   +1 You are returning 1 for this case:  if (a.row == b.row) { return 1; } Ideally it should return 0. What seems to be happening is, when a=b and b=c then a=c but due to above case, a=c is probably not holding true
•  » » » 16 months ago, # ^ | ← Rev. 2 →   0 Got it thanks bro @pribic and @bittubittu
 » 16 months ago, # |   +5 I understand it intuitively but can we rigorously prove that the graph is bipartite?
•  » » 16 months ago, # ^ |   +5 You can think about it like this. Consider the sum of the 2 coordinates. Every step you take changes the parity of this sum. To return to your starting point, your parity can only change an even number of times, but it changes exactly k times. Therefore, k must be even.
•  » » 16 months ago, # ^ |   +3 All the nodes a[i][j] will be connected only to the nodes a[k][l] if i+j and k+l has opposite parity.So the given graph can be divided into two parts, one with the parity of sum of indices as even and other as odd. Hence the given graph is bipartite.
•  » » 16 months ago, # ^ |   +7 Graph is always bipartite when it has no odd simple cycles. Let's take any cycle in this graph. Let's add some vertices to it which still form a cycle with the past ones. Their count will be 3..5..7 and so on. Besides, we must remove one edge, because it's needed to make the cycle simple.Picture (sorry for Paint):
•  » » 16 months ago, # ^ |   +24 Because any n * m grid can be converted to a chess board.
•  » » » 16 months ago, # ^ |   0 I_love_Kim_Dahyun Me too
 » 16 months ago, # |   0 Are there any ways to optimize dijkstra algo for problem D?
•  » » 16 months ago, # ^ |   0 Can we solve D using Dijkstra? I was getting wrong ans, not sure if I'm missing anything... https://codeforces.com/contest/1517/submission/114047555
•  » » » 16 months ago, # ^ |   0 I've got ML5 with not optimized dijkstra
•  » » » 16 months ago, # ^ |   +1 Consider a cell for which the distance is .......say number 'X1' and total number of edges to reach it is 'L1'. Lets say there is another path, length 'X2' and number of edges 'L2' such that L2 < L1 but X1 < x2 (remember the graph is weighted) . The problem with Dijkstra's is that it will always prioritise the path with lesser overall distance.
 » 16 months ago, # |   +17 In problem D, my solution was if I am at $(i, j)$ then I can go to $(i, j+1)$ using an edge of weight $W$ (let's say), and find the shortest path of length $k-2$ that starts at $(i, j+1)$ and also ends at $(i, j+1)$ and then finally return to $(i, j)$ using the same edge of weight $W$. So, $dp[i][j][k] = 2*W + dp[i][j+1][k-2]$.Do the same for all of the adjacent vertices, the minimum is the answer.
•  » » 16 months ago, # ^ |   +5 But how is this always minimum? What if we go out through a particular edge but return through a different edge?
•  » » » 16 months ago, # ^ |   +8 It's easy to prove that it's always ideal to go half way in one direction and then just return along that path.Consider a node in the graph V. Let's say you have found a random path of length k that begins and ends at V, and this path enters and leaves V from two different edges.This would roughly look something like a loop. Now since the length of this path is even, we can divide it into two halves. There can be two cases — The costs of the two halves are unequal. The costs of the two halves are equal. If the costs of the two halves are unequal, we can reduce the total cost of the path by just going forwards and backwards on the cheaper half.If the costs are equal, going forwards and backwards on any half will not change the total cost.Thus, it is always ideal to go half way in one direction and then just return along that path.Hope this helps.
•  » » » » 16 months ago, # ^ |   0 Yeah that is correct....the reason this works is because k is an even number
•  » » » » 16 months ago, # ^ |   +1 Thanks for this!
•  » » » » 16 months ago, # ^ |   +3 That was a nice proof, thanks for writing it.
•  » » » » 16 months ago, # ^ |   0 I am solving this problem but got WA on test 5. I can't figure out what's wrong. Here's my commented code, if you get free time then kindly help.Submission
•  » » » » » 15 months ago, # ^ |   0 Working SubmissionBased on similar idea
•  » » » » » » 15 months ago, # ^ |   0 I forgot to edit this. The main issue was that I was taking the 2nd input in the wrong order.
•  » » 16 months ago, # ^ | ← Rev. 2 →   0 I found your solution very helpful. thanks I_love_Kim_Dahyun :)
 » 16 months ago, # | ← Rev. 2 →   +9 Problem E: How can the case $(C/P)CC...CPCPC...PCPP...P(C/P)$ be calculated in $O(N)$? For me the definition of the state looks like this: We have the C/P at the beginning or the end. This is a constant factor. Then we have the CCCCC-Part, the PCPCPC-Part and the PPPPP-Part. To check the sum-condition for all cases we need to iterate over all 3 lengths. the 3rd lengths follows from the 1st and second since their sum is constant. But that sounds like iterating two lengths and it amounts to $O(N^2)$? What is the observation that I am missing to make it $O(N)$?
•  » » 16 months ago, # ^ |   +33 You iterate over length of $CC...C$ and the minimum acceptable length of $PP...P$ can be found using binary search or two pointers, because all the numbers in the array are positive, and function $\sum_P - \sum_C$ is monotonous.
•  » » » 16 months ago, # ^ |   0 Ah, I get it. Thank you very much!
•  » » » » 16 months ago, # ^ |   +1 Can you explain approach of problem E in detail, thankyou.
•  » » 16 months ago, # ^ | ← Rev. 3 →   +19 If you have some kind of alternating prefix sum array to quickly calculate the sum of P if some range is PCPCPC(let's call it $pr$ and if the range is between the $i+1$-th and the $j$-th element then the sum is $pr_j-pr_i$), when fixing the point where you switch from PCPCPC to PPPPPP(let's call it $j$), if the point where you switch from CCCCCC to PCPCPC is $i$, then the condition is $pr_j-pr_i+sum(j+1..n) \geq \left \lfloor{\frac{sum(array)}{2}+1}\right \rfloor$. You can find the maximum $i$ for which that condition holds using either binary search or 2 pointers.
•  » » » 16 months ago, # ^ |   0 Where is $\left \lfloor{\frac{n}{2}+1}\right \rfloor$ from? I would assume there had to be $sum(1 ... i-1)$ instead? Maybe I misunderstand your formula.
•  » » » » 16 months ago, # ^ |   0 I edited it now.
•  » » 16 months ago, # ^ |   0 My solution is similar to dorijanlendvaj's for the part with alternate partial sum, but I used a data structure (e.g. fenwick tree, segment tree, treap) to maintain the number of i satisfying the inequality. For stupid people like me who can't spot the obvious property of monotonicity, it is a lot more intuitive. The code can also be pretty short if you are familiar with data structures, check my code here: 114032392.
•  » » » 16 months ago, # ^ |   0 Could you please explain how we concluded that:"There can't be two i's such that ci−c(i−1)>2, or pi−p(i−1) won't be non-increasing. And there can't be two i's such that pi−pi−1>2, or ci−c(i−1) won't be non-decreasing. So for any 2≤i
•  » » » » 16 months ago, # ^ |   0 Ah, so ci and pi is indexes of array "a", not the elements of "a". Now I got it.
 » 16 months ago, # |   +36 dpforces
 » 16 months ago, # |   -7 In D, is not not two dimension more complecated to think about the graph beeing bepartite, and hence does not allow paths of a given parity?Instead, foreach step we do, we must do a step in the oposite direction. So the number is even.
 » 16 months ago, # |   0 please provide cpde also
 » 16 months ago, # |   0 Problem C is a simple dfs from each cell on the diagonal. For each cell first visit left cell , then down and then right. During this keep reducing the count and once it becomes 0 , return. This will pass all tests.
 » 16 months ago, # | ← Rev. 3 →   0 solved
 » 16 months ago, # |   +3 In problem C could someone help in justifying the second construction ? How to prove that it will always work ?
•  » » 16 months ago, # ^ |   +5 My approach is also similar to editorial.Consider a rubber attached to the point i,i. We want to stretch the rubber p[i] times. So the optimal choice is to stretch the rubber in the following order1-Strecth the rubber up2-Strecth the rubber left3-Strecth the rubber down4-Strecth the rubber rightThis ordering will always ensure that we don't have any empty space left. See submission for more details:114016611
•  » » » 12 months ago, # ^ |   0 I was able to solve the question with this approach thnx a lot , but the point is how were u able to think of this??
 » 16 months ago, # |   +1 Video Editorial for problem C: https://youtu.be/RVE8Xprwsfo
•  » » 16 months ago, # ^ |   +1 Video Editorial for problem B: https://www.youtube.com/watch?v=F5zq_BU25Ac&t=397s
 » 16 months ago, # |   +5 Hey guys, i found this very strange submission to problem D of this contest (114038234 belonging to the user pxsitivevxbess) and was wondering if anybody could explain to me the logic behind the excessive usage of "ashwet++".
•  » » 16 months ago, # ^ |   +3 I think I've seen it before, it's to evade the plagiarism checker. Maybe you could report that to MikeMirzayanov.
•  » » » 16 months ago, # ^ |   0 How to report someone for plagiarism?
•  » » 16 months ago, # ^ |   0
 » 16 months ago, # |   +41 Amazing editorial for problem G, the amount of details is simply astonishing
•  » » 16 months ago, # ^ | ← Rev. 3 →   +8 The problem has two types of forbidden pattern: the "square" and the "parallelogram". the square corresponds to 1-0-3-2-1 while parallelogram to 1-0-2-3-1. On the surface, it seems you have to add two kind of edges between rows: 0-3 1-2 (vertical ones) and 0->2 1->3 (diagonal ones)But the key observation is that you don't need to, you only need to add edges 0-3 and 1-2. The reason is because to check for parallelogram, you can actually just use the same check: whether a path 0-1-2-3 exists. If such a path exist, then it must either be a square or a parallelogram, e.g.: ...10...01... ...23...32... for squares and ...10...01... ..32.....23.. for parallelogramsTherefore, we consider the acyclic graph where all "0" nodes have edge to "1" node, all "1" node to "2" nodes, and all "2" nodes to "3" nodes. in this acyclic graph, we want to cut fewest weight nodes so that no path exists from "0" to "3". This can now be done easily using min cut.
•  » » » 16 months ago, # ^ | ← Rev. 2 →   0 What about a parallelogram that looks like...10........32..It won't be covered by a 0-1-2-3 path, only a 1-0-3-2 path, so how do we take care of these cases?Ps. your second square case should be0132
•  » » » » 16 months ago, # ^ |   0 These kind of parallelograms are not meant to be forbidden as important tents are represented by "1" and this parallelogram is not breaking the given condition ( $|x_2 - x_1| = 2$ but it should be $|x_2-x_1| \le 1$
•  » » » » » 16 months ago, # ^ |   0 Right, I misread the question.
 » 16 months ago, # |   0 why in d you need k/2 only.suppose we go to next edge and its cost is 1 but after that costs are 10^6 so why shouldn't i go back and forth only to complete k steps rather than include 10^6 in my ans?
•  » » 16 months ago, # ^ | ← Rev. 2 →   +3 It is not possible.Supposition: The optimal cost to travel k/2 steps is C.If you move k/2 steps with cost C and if there exist a returning path with length k/2 that has C' < C.Then you can move in the later path to get a cost of C'.But this is not possible because of the supposition.Hence we can always travel k/2 steps and return with the same path.
•  » » » 16 months ago, # ^ |   0 i am asking if suppose i have next edge cost=1 and all edges after wards have cost of 10^6 then why should i go exact k/2 steps in forward direction why not jhust go b/w current vertic and next vertex whose edge has cost 1 and complete k steps in this manner ? why would u inlcude 10^6 in your ans?
•  » » » » 16 months ago, # ^ |   +3 You misunderstood my statement.Suppose you are initially at $A$ and after completing $k/2$ steps you are at position $C$. So in order to get the minimum answer you must retrace the same path that you have to taken to reach to $C$ to $A$.That's why we only have to check $k/2$ steps.And steps doesn't mean you have to always move forward. You can also move 1 step forward then backward then forward and so on until all $k/2$ steps are exhausted.
 » 16 months ago, # |   -30 implementForces :)
 » 16 months ago, # |   0 can anyone help me understand where my submission is going wrong. submission linkError is : wrong answer the sequence is not identical (test case 1) TIA.
 » 16 months ago, # |   +8 In Problem D, multi-source Dijkstra with a priority queue gets TLE: 114052809. But if the priority queue is replaced by a normal queue, it gets AC in 405 ms: 114052881.I think the solution with the queue should get TLE too. But I couldn't come up with an appropriate case. Can anyone try to uphack the solution? Or am I missing something?
•  » » 16 months ago, # ^ |   0 For Dijkstra's, the exit condition should be - new_codewhile (!pq.empty()) { info u = pq.top(); pq.pop(); if (dist[u.r][u.c][u.lv] < u.w) continue;instead of old_codewhile(!pq.empty()) { info u = pq.top(); pq.pop(); if(dist[u.r][u.c][u.lv] != u.w) continue;check out my submission, I just modified this line and it passses — https://codeforces.com/contest/1517/submission/114073092
•  » » » 16 months ago, # ^ | ← Rev. 3 →   0 Actually, both are performing the same purpose here.dist[u.r][u.c][u.lv] holds the minimum possible cost for [u.r][u.c][u.lv] till now. So, obviously dist[u.r][u.c][u.lv] != u.w means the value of u.w is greater than dist[u.r][u.c][u.lv].Edit: Your submission is passing because of the compiler. I've submitted with != operator using "GNU C++17" compiler and got AC in 1856 ms: 114108137.
•  » » 16 months ago, # ^ |   0 By the way, can you explain your logic for Multi-Source Dijkstra's? Mostly why this holds true in this problem?Also, the queue solution should be incorrect, because Dijkstra's requires a priority queue for the same?
•  » » » 16 months ago, # ^ |   +3 Logic: For a cell (r, c), we need to find the minimum cost after h steps if we start from the cell (r, c). As the graph is undirected, it is equivalent to reach the cell (r, c) from an arbitrary cell after h steps. So, we can do it by taking every cell as the source and calculate the dist[r][c][h] for each cell. It is normal Dijkstra. The rest calculation part for the minimum boredness is quite easy.Queue solution: Dijkstra needs a priority queue (min-heap) just to reduce the complexity. Taking queue won't make your solution incorrect. In normal graphs, it will increase your complexity.
•  » » » » 16 months ago, # ^ | ← Rev. 2 →   +3 So you are saying that - We can do Dijkstra's using queue OR Required implementation in this problem doesn't require a priority queue
•  » » » » » 16 months ago, # ^ | ← Rev. 2 →   +3 Yes, we can do Dijkstra using a queue. But the complexity will be bigger. In the worst case, it will be $O(VE)$. I'm not sure actually. But most probably, yes. Firstly, the way I've implemented Dijkstra, using queue in it almost makes it SPFA. Secondly, For a cell $(r,c)$, you need to go at most $10$ steps. So, the number of cells needed to traverse from a single source reduces a lot. It is quite a large restriction. With this restriction, there's a chance that making the worst case for $SPFA$ is impossible. Edit: I'm saying both.
•  » » » » » » 16 months ago, # ^ |   +8 Thanks for the descriptive response :) I didn't know the queue solution looked like SPFA. That's nice observation.
•  » » » » » » » 16 months ago, # ^ | ← Rev. 2 →   0 Thanks and Welcome :)
 » 16 months ago, # |   +27 Can you explain the $n^2log(n)$ solution for problem F? Thanks.
•  » » 15 months ago, # ^ | ← Rev. 3 →   +5 I haven't yet tried, but I guess you can optimize the dp with some heavy-light decomposition trick. I guess, since the number of dp states at node v is of O(depth_of_subree_rooted_at_v), when dealing with node v, you can inherit dp states from the heavy child (child with the maximum subtree depth) and iterate the rest children. That way, you end up with a O(nlogn) dp per radius, then O(n^2 log n) for all radius.
»
16 months ago, # |
-72

hey anyone who can find whats wring in my code of problem B

# include<bits/stdc++.h>

using namespace std;

# define mod 1000000000

int main() { ll t; cin>>t; while(t--){ ll n,m; cin>>n>>m; ll a[n][m]; ll b[n][m]; ll temp=0; vector<pair<ll,ll> > v(m);

for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){
cin>>a[i][j];
b[i][j]=a[i][j];
}
}
//v[0].first=3;

while(temp!=m){
ll c=mod;
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){

if(a[i][j]<=c){

c=a[i][j];

v[temp].first=i;

v[temp].second=j;
}

}
}
a[v[temp].first][v[temp].second]=mod;

temp++; }

for(ll j=0;j<m;j++){
swap(b[v[j].first][v[j].second],b[v[j].first][j]);

}

// cout<<el; for(ll i=0;i<n;i++){ for(ll j=0;j<m;j++){ cout<<b[i][j]<<" "; } cout<<el;}

} return 0; }

•  » » 16 months ago, # ^ |   +5 Please use pastebin or use spoiler to share your code, directly pasting the code pollutes the blog :)
 » 16 months ago, # |   0 Help me out with A folks I don't know how to find sum of its digits in decimal representation.
•  » » 16 months ago, # ^ |   +9 Well, you can prove to yourself that the last digit of "n" is always (n%10) = n modulo 10 (the rest when you devide n by 10. Now, you use a while and at every step you add n%10(last digit) and then devide n by 10 (that eliminates the last digit). You have to do this until n is equal to 0. When that happens you stop the iterration and that's the sum. Hope it was not a joke and I actually helped. :))
 » 16 months ago, # |   +14 I haven't understood the editorial of problem E, can anyone explain it in detail?
•  » » 16 months ago, # ^ | ← Rev. 4 →   0 C and P are two sets of all indexes of "a" (together — "n" elements). Indexes of C is growing wider left-to-right, and P — right-to-left. If for some ci-c(i-1) > 2 than there should be two P's in a row between them. And this means there can't be no more P's to the left from them, and to the right(max — 1), because pi-p(i-1) become 1, and to jump over C it need to become 2 — this breaks monotonic rule. And so on.
 » 16 months ago, # |   0 Can someone please help me out with What am I missing in B problem? My Solution
•  » » 6 weeks ago, # ^ |   0 Have you solved it? I have the same question, if so, please reply, thanks
•  » » » 6 weeks ago, # ^ |   0 Yes solved, AC Solution. Let me know if any doubt.
•  » » » » 6 weeks ago, # ^ | ← Rev. 2 →   0 thanks
 » 16 months ago, # | ← Rev. 3 →   0 .
 » 16 months ago, # |   0 Can someone explain Problem B?
•  » » 16 months ago, # ^ |   0 Check this image out — click the imageBasically, get the top m minimum numbers from the all the entries, and position them stategically such that the order of min elements is followed.As you can see the image, we want to permute each row, such that the min numbers(in red) are positioned one after the other.You can check my submission for more details — https://codeforces.com/contest/1517/submission/114011935
•  » » » 16 months ago, # ^ |   0 Hi, thanks for the reply. I understood the basic idea. Could you tell me what is wrong with my submission? https://codeforces.com/contest/1517/submission/114070887
•  » » » » 16 months ago, # ^ | ← Rev. 2 →   0 You are modifying the modified elements in each row, you need to skip those positions, which have been modified.Like you might modify (0, 0) and then later you might check for an element(0, i) which matches at (0, 0), so might change the value.Keep a set of modified elements, which would want to skip, that might help
•  » » » » » 16 months ago, # ^ | ← Rev. 4 →   0 .
•  » » » » » 16 months ago, # ^ |   0 hey, thanks for the visual explanation, in my approach, I used a set to store the smallest m elements and a dictionary to store all the indices pair. I set col=0 and iterate through all n path lists, then iterate through each path list (i
 » 16 months ago, # |   0 I dont really understand problem B.Can someone help me? (if u can give sample code its better)
•  » » 16 months ago, # ^ |   0 Problem B videoEditorial (explained in detail) link : https://www.youtube.com/watch?v=mY8tcan90sQ
 » 16 months ago, # |   0 Can anyone kindly help me to understand the Problem B? I didn't get the editorial...
•  » » 16 months ago, # ^ |   0 Hey, so try thinking it this way. In problem B, you're given a matrix, where every ith row represents the paths a runner can choose, to go from ith checkpoint to (i+1)th checkpoint. Now what does the question ask? The question asks you to assign paths to every runner, such that the sum of the minimum paths of each runner is also minimum. And, the number of runners = number of paths for each checkpoint = number of columns = m (as in the question). Now for every element in the matrix, you can't change its row cause that would mean changing a checkpoint and that's not permitted. But you can change its column, and at the end output a matrix where every column represents all the paths taken by a single runner. Now all you have to do is find the minimum of each column and take its sum. This sum should be minimal. When can it be so? When will the sum of m elements be minimum when you have m*n elements to choose from? When the minumums of each column (and there being m columns) are made by the m minimum paths of all the m*n paths given to you. So try finding the m smallest paths from all m*n paths and then make sure that these paths are placed in their respective rows and different columns, so that each of these is the smallest in its column. Then the other places in the solution matrix can be filled in any order, but make sure that you don't change the row of any element. Also be careful that you don't overlap the paths in a row. The rows of the output matrix should be permutations of the rows of the input matrix.
•  » » » 15 months ago, # ^ |   0
•  » » » » 15 months ago, # ^ |   0 please check this bro can you find the bug:no compilation error
•  » » » 15 months ago, # ^ |   0 i upvoted you lol
•  » » 16 months ago, # ^ | ← Rev. 2 →   0 nice Explanation
•  » » 16 months ago, # ^ |   0 Problem B videoEditorial (explained in detail) link : https://www.youtube.com/watch?v=mY8tcan90sQ
 » 16 months ago, # |   +1 Can anyone help can't figure out what's wrong with my problem D solution.WA on Test 5 114051343
•  » » 16 months ago, # ^ |   +4 The same thing happened to me. You are taking the input wrong way.
•  » » » 16 months ago, # ^ |   0 Thanks a lot.
 » 16 months ago, # |   0 can anyone explain number 2? I dont get the editorial since I'm new here ;-;
•  » » 16 months ago, # ^ |   0 Problem B videoEditorial (explained in detail) link : https://www.youtube.com/watch?v=mY8tcan90sQ
•  » » » 16 months ago, # ^ |   0 Thanks!!
 » 16 months ago, # |   0 If problem "C" were in position of problem "B" then it could have been submitted by more participant during contest time. The implementation of "B" was quite lengthy and tricky than "C".
 » 16 months ago, # |   -8 Problem B videoEditorial (explained in detail) link : https://www.youtube.com/watch?v=mY8tcan90sQ
 » 16 months ago, # | ← Rev. 2 →   0 1517B - Morning JoggingStatus : ACMy Solution Is Find The Smallest M Elements And Put Each Item In Different ColumnMy Submition : 114096708Note : Must Be To Update Information When Swap 2 ElementsBecause Is Some Cases Are Swap 2 Element Are Existing in Array With M Element And You will get substitutions for wrong items Not Existing in Smallest M Elements
 » 16 months ago, # | ← Rev. 3 →   -18 I really liked the idea for the problem C & D.
•  » » 16 months ago, # ^ |   +11 We want to know more of your liking.
 » 16 months ago, # |   -11 Problem C videoEditorial link : https://www.youtube.com/watch?v=w4XUoQScG90
 » 16 months ago, # | ← Rev. 3 →   -8 In prob-D, Can anybody tell the number of states we will have while calculating the shortest path of length K/2 from some vertex u? I think its around K^2 because starting from vertex 'u' ideally, we will traverse in square of K*K sizeUpdate: Got the answer
 » 16 months ago, # |   0 I did try to implement what you have said in B.But somehow its not passing all test cases. Can someone please tell what is wrong with mycode. https://codeforces.com/contest/1517/submission/114183214
 » 16 months ago, # |   0 HI! can someone explain Problem D. I have solved the problem using Dp, recursion during the contest. I wanted to understand the iterative solution. thanks a lot in advance!.
 » 16 months ago, # |   0 please give the codes as well
 » 15 months ago, # |   0 The editorial for problem H says: 'We will explain the precision issues later', but that part seems to be missing. Can somebody please add that part? In my attempts to solve the problem, I struggled with precious issues for quite some time, and I added several hacks until I finally got AC (114778549).
 » 15 months ago, # |   0 can someone please send the implementation of problem 2 (morning jogging).
 » 15 months ago, # |   0 can someone please tell me why my solution is getting tle. approach:iterate through the diagonal and we observe that either the first element or the last element has only one place to go and similarly the one above it. we build the solution by iterating this n times. clearly it is working in o(n^3) submission
 » 14 months ago, # |   0 Did anyone solve Problem D with Matrix exponentiation?
 » 14 months ago, # | ← Rev. 4 →   0 .
 » 13 months ago, # |   0 In problem D, I don't think I see why it's optimal to walk a path and then backtrack. Considering the edge on a so-called optimal path with minimum x, wouldn't it always be more or equally optimal to back-and-forth across this edge than to go the rest of the walk and come back?
 » 11 months ago, # |   0 Good Editorial!!!
 » 11 months ago, # |   0 it is easy
•  » » 11 months ago, # ^ |   0 Maybe)))