### jinlifu1999's blog

By jinlifu1999, history, 9 months ago, ,
Code
Code
Code
Code
Code
Code

• +85

 » 9 months ago, # | ← Rev. 2 →   +3 Problem E should have 512MB(or 1GB) of Memory limit :(
•  » » 9 months ago, # ^ |   +8 In the author's solution, DP state reduction is used.
•  » » » 9 months ago, # ^ |   0 Yeah, state reduction.But in polygon, the system warns if the jury solution solved the problem with more than half of time limit. Why not for memory limit :( I am so sad.
•  » » » 8 months ago, # ^ | ← Rev. 3 →   0 I am getting wrong answer on the 5th test case. Not sure what I am missing. Could you please help?I am using segment trees + lazy propagation for querying the maximum possible weight and d-value at an index and DP over these values. Here's my code: 50479788. Help is very much appreciated. Thanks.
 » 9 months ago, # |   +5 I believe there is a slight correction in the proof of C. bi and ci form a corresponding grouping only if the following condition holds:bi = cj if and only if bj = ci.The proof still holds because each grouping can be mapped to a bi, ci and the optimal bi, ci can be mapped to a grouping.
•  » » 9 months ago, # ^ |   0 Fixed. I'm not sure if it is fine now. I'm a bit dizzy today. Wait a minute and the modification will be shown soon.
•  » » » 9 months ago, # ^ |   0 can you explain why my solution is incorrect,please 49283839
•  » » » » 9 months ago, # ^ | ← Rev. 2 →   0 DFS is not suitable here. See this comment
 » 9 months ago, # |   0 Probably, in B, it should be O(n + m + MAXC) instead of O(n + m).
•  » » 9 months ago, # ^ |   0 Did you use something called "bucket"? Actually it is not necessary to use that. A priority queue or a pointer is sufficient.
•  » » » 9 months ago, # ^ |   +8 Could you please explain how the pointer leads to linear solution? Since dishes are not ordered by cost, we need to sort them first, right? It is already .
•  » » » » 9 months ago, # ^ |   0 Oh ... I did make a mistake. I will modify this. Sorry for that.
 » 9 months ago, # |   0 In problem E , instead of the sweep line thing , i used a segment tree to cover the best red envelope in some range , and did the same Dp approach , however i'm still getting Wrong answer.Any help would be appreciated , if my approach is wrong please let me know.
•  » » 9 months ago, # ^ |   +1 10 0 5 4 9 10 1 7 10 10 1 3 8 9 1 6 7 10 1 6 6 7 1 This is pretest 22 and the answer should be 2. However, you output 1.
•  » » » 9 months ago, # ^ |   0 Thanks for the test.I read over and over my code and it looks just okay , so im starting to wonder if the approach is just wrong ..
•  » » » » 9 months ago, # ^ |   +1 Well I don't know how to use segment tree with the operator max, except that there is a technique called Segment Tree Beats. Hope you figure out your problem. :)
•  » » 9 months ago, # ^ |   +2 Before assigning a value to your lazy array you should check that you don't have a lazy value in your current node or that the value you want to put is better that your current lazy.Something like this 49285040
•  » » » 9 months ago, # ^ |   0 Tried it but still not working :\ But thanks !https://codeforces.com/contest/1106/submission/49289629 you meant me doing like that ?
•  » » » » 9 months ago, # ^ | ← Rev. 2 →   0 UPD : I got it accepted just after reading this blog : https://codeforces.com/blog/entry/57319I highly recommend reading it , so beneficial !Thank you jiry_2 !Also thank you jinlifu1999 for mentioning the name of the trick !
 » 9 months ago, # | ← Rev. 4 →   0 Any test case for this Problem:D https://codeforces.com/contest/1106/submission/49285955
•  » » 9 months ago, # ^ |   0 Try playing around with the following test: 4 3 1 2 2 4 1 3 Your solution will print 1 2 4 3 which is not the correct answer.
•  » » » 5 months ago, # ^ |   0 Can you tell the correct order
•  » » » 4 months ago, # ^ |   0 hey .. can you please tell why sorting doesn't work in this case
•  » » » » 5 weeks ago, # ^ |   0 Because it doesn't care the path. At node v, you can go back to parent(v) and go to other nodes with smaller number.
 » 9 months ago, # | ← Rev. 2 →   -30 In my opinion problem F is unreasonably hard for div2 (and not only to come up with a solution but also to implement)
 » 9 months ago, # | ← Rev. 2 →   0 My WA approach for E-Sort all events Maximum Coins and then Maximum d.Iterate on all events. I'm assigning a specific event for each moment, which I will select If not blocked and I can select an event. Made dp states similar to editorial.Took minimum of -If blocked n-1(times),d-1(no of times blocked in i
•  » » 9 months ago, # ^ |   +13 After that, we use a set with a sweep line to deal with it. — How ??The transition is trivial and you can take a look at it in the code. — Not for me. Please elaborate exactly what you are doing. And why you are updating f[j & 1][a[i].d + 1]
 » 9 months ago, # | ← Rev. 2 →   0 My solution for D is getting MLE. can someone help me? https://codeforces.com/contest/1106/submission/49291115
•  » » 9 months ago, # ^ | ← Rev. 2 →   0 you shouldn't keep duplicates of vertices in a queue, so when vertex is visited don't push it to queuehttps://codeforces.com/contest/1106/submission/49292899
 » 9 months ago, # |   +15 Today I learned the big-step baby-step algorithm, and about primitive roots. Problems E and F are very interesting. I'm sorry that this round faced technical difficulties, but I enjoyed it nonetheless.
 » 9 months ago, # |   0 Can someone explain why i am getting a "runtime error: constructor call on misaligned address" on problem E. Any help would be appreciated. https://codeforces.com/contest/1106/submission/49293426
•  » » 9 months ago, # ^ |   0 The diagnostic message is not for your solution. Your solution gave a wrong answer that the checker wasn't prepared to handle, and the checker faced a runtime error. The diagnostic message is for the checker.Your verdict is simply WA.
•  » » » 9 months ago, # ^ |   0 But the diagnostics mentions function, std::pair > &, std::pair, std::pair > &)> which i have used in my code.
•  » » » » 9 months ago, # ^ |   0 I am very surprised to see that. I was certain that it might be due to the checker. But now I am not that sure.One of the things that is curious is that you asked for GNU C++ compilation, but the diagnostic message mentions clang++ and MSVC. So that's suspicious indeed. Please check once if your comparator is well defined.
•  » » » » » 9 months ago, # ^ |   0 Checked the comparator.Looks alright.
•  » » » » » » 9 months ago, # ^ |   0 I think there might be something wrong with your solution, I copied it and changed it to this and no more exception but still wrong answer on test 7. #include #define mp make_pair #define mt make_tuple #define x first #define y second #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ve vector #define forn(i,n) for(int i=0;i<(int)n;i++) #define for1(i,n) for(int i=1;i<=(int)(n);i++) #define ford(i,n) for(int i=(int)(n)-1;i>=0;i--) #define fore(i,a,b) for(int i=(int)(a);i<=(int)(b);i++) #define pb push_back #define print(v) for(int i:v) cout<>v[i]; #define sz(a) (int)(a.size()) using namespace std; typedef long long ll; typedef vector vi; typedef pair ii; typedef vector vii; typedef vector vvi; int main(){ IOS int n,m,k;cin>>n>>m>>k; vector> v(k); forn(i,k){ cin>>v[i].x.x>>v[i].x.y>>v[i].y.x>>v[i].y.y; v[i].x.x--;v[i].x.y--,v[i].y.x--; } sort(all(v)); // for(auto& p:v){ // cout<& a, const pair& b){ if(a.y.y==b.y.y) return a.y.x,ve>,decltype(com)> pq(com); for(int i=0;ii) break; // cout<<"ptr"<> DP(n+1,vector(m+1,-1)); // cout<<"s"< sol=[&](int i,int j){ // cout<=n) return 0LL; if(DP[i][j]!=-1) return DP[i][j]; DP[i][j]=sol(best[i].y+1,j)+(ll)best[i].x; if(j){ DP[i][j]=min(DP[i][j],sol(i+1,j-1)); } // cout<
•  » » » » » » » 9 months ago, # ^ |   0 Figured already.I missed a condition in the DP part of code,which in no way could have caused byte misalignment.The diagnostic was incorrect. Thanks anyway.
•  » » » » » » » 9 months ago, # ^ |   +3 Your defines are awful.
 » 9 months ago, # | ← Rev. 3 →   +5 Can anyone explain the solution of problem E in detail,please ? The "SWEEP LINE" term mentioned in the editorial isn't clear to me.I understood the second part but i'm stuck with the first part. Thank you.
•  » » 9 months ago, # ^ | ← Rev. 5 →   +16 I'll try to explain, but my words might be unclear. Perhaps you could take a look at my submission. It might help. In my code dp[t][dist] = minimum possible money that can be earned by Bob when starting from time t, and dist disturbances are remaining with Alice. The answer that we are looking for is dp[1][m]. The recurrence for this would be as follows: If best letter at time t is (starti, finishi, delayi, rewardi), then the recurrence would be as follows: dp[t][dist] = min(dp[t + 1][dist - 1], dp[delayi + 1][dist] + rewardi) The first case corresponds to Alice using up a disturbance, and the second case is when she doesn't. If there is no letter that Bob can open at time t, then the dp recurrence is: dp[t][dist] = min(dp[t + 1][dist], dp[t + 1][dist - 1]) You can work out the base case of this dp yourself. A more fundamental question is that why does this DP work? Especially because we are not keeping any state of what are the envelopes used up or remaining at a particular time. One insight to have is this: If we could ignore the start and finish times of the envelopes, then there is a preference order amongst all the envelopes. (Basically prefer the ones that give more prize, and choose the ones that will delay more). However, at a time instant t, you can only choose amongst the envelopes that belong to that time instant, i.e. starti ≤ t ≤ finishi. You don't need to worry about any other envelopes. In particular you don't have to worry that these envelopes are already chosen, because if it had been chosen already, then in the recurrence, it will check only after the delay. So if we are iterating through time backwards and keeping a Priority Queue of the valid envelopes, then we need to insert and remove envelopes at the correct times (at finishi and starti) when they become valid and invalid. This is what is being referred to as SWEEP LINE. Maybe the phrase is used a bit incorrectly used in this case (but there are some strong similarities in the ideas).
•  » » » 9 months ago, # ^ |   +5 What is dp[delayi  +  1][rewardi]?dp[delayi  +  1][dist]?
•  » » » » 9 months ago, # ^ |   +10 Maybe dp[delayi + 1][dist] + rewardi?
•  » » » » » 9 months ago, # ^ |   +3 Apologies. Thanks. Fixed.
•  » » » » 9 months ago, # ^ |   0 I've corrected the error. Thanks for pointing it out.
 » 9 months ago, # | ← Rev. 2 →   0 I tried Problem E.I let dp[i][j] be the coins Bob can obtain in time j with Alice already disturbed i times.Let w[j] be the coin from the next envelope Bob can get if he is free at time j.Let d[j] be the next time Bob can be free after getting this envelope.then dp[m][j]=dp[m][d[j]]+w[j]dp[i][j]=min(dp[i+1][j+1],dp[i][d[j]]+w[j])But I got a Wrong Answer at test 5, which is very hard to find out the wrongs in my code.I'll keep trying...
•  » » 9 months ago, # ^ | ← Rev. 2 →   0 Please notice that f[ * ][m] might not be the optimal policy. Alice may not use all m chances to disturb Bob, which might reach a smaller answer.
 » 9 months ago, # |   +5 In 1106A, scanf("%s", a[i] + 1);, why a[i]+1 is used? Why it is needed to add 1 there?
•  » » 9 months ago, # ^ |   0 If you do not add 1, the variable j should start from 0.
 » 9 months ago, # |   +13 There's something worthy to note about problem F that I came up with while testing. After reducing the problem to finding an integer x such that xp = m using matrix expo, we can find x in O(log(n)) but if and only if gcd(p, mod - 1) = 1. Let inv be the modular inverse of p with respect to mod - 1:
•  » » 9 months ago, # ^ |   0 It was this line of thinking that led me in quite a wrong direction in the contest.For the case where gcd(p, mod - 1) > 1, then we can reduce it to the case where p divides mod - 1 by the following steps: g = gcd(p, mod - 1) = ap + b(mod - 1)Then, Because mod - 1 has only three prime factors 2, 7 and 17, I was trying to find a special solution for those three powers, and entered into the number theory rabbit hole of quadratic residues.
•  » » 8 months ago, # ^ |   0 Is there a way to solve the equation when gcd(p, mod-1) != 1 or this solution works only when gcd = 1?
•  » » » 8 months ago, # ^ |   +8
•  » » » » 8 months ago, # ^ |   0 Great, Thank you!
 » 9 months ago, # | ← Rev. 2 →   0 I also did the same thing mentioned in the editorial for B problem . Just used a set and simulated the process . I am getting a runtime error on the first case but in my local machine I am getting a right output . Can someone help me with the error ?Link for the submission is : 49266362
 » 9 months ago, # |   +5 At first I think D is very similar to NOIP2018 D2T1,but at last, it turns out that I am wrong.The code is same as the wrong code I wrote at NOIP2018.
•  » » 9 months ago, # ^ |   0 same, took me a long time to find out that it is not NOIPD2T1 with extra edges :(
•  » » » 8 months ago, # ^ |   -8 真的是两个中国人说话讲缨语然后我也是D2T1写挂/px
 » 9 months ago, # |   0 Why am I getting runtime error on pretest 2 in Problem D? It is running fine on other online ide like gfg. https://codeforces.com/contest/1106/submission/49308034 Pls help!
•  » » 9 months ago, # ^ |   0 Do not use set, use priority_queue instead, it will work fine. It's with the erase function of set which is showing undefined behavior. I also faced same issue.
•  » » » 9 months ago, # ^ |   0 Thanks buddy
 » 9 months ago, # |   0 Is there anyone who can explain the problem E in details? I'm trying to figure it out, but it doesn't work. I hope someone do me a favor please.I understood what the problem requires, but I can't understand the way 1) calculating max coin 2) what structure you are using in calculating max coin (Why use map(set)?, what's the purpose of it?)Because of my understandings, I also don't know about DP definition. After understanding the way above, I will try to understand DP approach.Thanks in advance...
•  » » 9 months ago, # ^ | ← Rev. 2 →   0 Perhaps you could take a look at my comment above. Comment Link
•  » » 9 months ago, # ^ |   0 For DP part you can look at proofbycontradiction's comment above.We use map because we need to get the max event of each 'time' on timeline effectively.Map is a balanced binary search tree, which means elements in it is sorted.Therefore, we can get the max event(equals to the max coin) among all events in the tree by cur.begin()->first.In order to calculate the max coin of every 'time' on the timeline effectively, we introduce two vector array add[N] and remove[N]. At any 'time' i, if there're some events in add[i], just insert them into the tree(map). If there're some events in remove[i], remove every of them from the tree.By doing this, it is guaranteed that at all 'time' i, for all events in the tree, the event's range includes i, and there doesn't exist such an event in the tree such that this event's range doesn't include i. Also, all events whose range includes i are in the tree.When reading data from input, just add[s].push_back(event), remove[t + 1].push_back(event). We use t + 1 because s and t are inclusive, so you should remove it from tree at t + 1.You can calculate the max event of current 'time' during dp, or calculate them before dp. Both works.Sorry for bad English, hope this helps! :DPlease correct me if there's any mistake, thanks!
 » 9 months ago, # |   0 I'd like to ask about C problem.I came to know that we want to minimize sum bi * ci.But, I can't know , why we sort ai(bi, ci), when we come to know we want to minimize sum bi * ci. Is there provement?
•  » » 9 months ago, # ^ |   +3 Here is the proof written by anayk 1: Groups must be formed as pairs of 2.Proof: As (a+b)^2 > a^2 + b^2 for positive a, b, we want to minimize group size. As size has to be greater than 1, and N is even, all group sizes must be 2.Now, we have to pair each number with another such that sum is least. We double this sum. This doubled sum can now be represented as summation (ai + bi)^2 where ai and bi are both permutations of the given numbers.2: ai and bi must be oppositely ordered sequencesProof: summation (ai + bi)^2 = summation (ai)^2 + summation (bi)^2 + summation (2*ai*bi); We want to minimize this sum. We observe that the first two terms are constants (sum of squares of all given numbers). So, we want to minimize the 3rd term. This is done when ai and bi are oppositely ordered, proof is a direct application of rearrangement inequality.Now, observe that this doubled sum corresponds to the pairing where ai is paired with a(N-i+1), with i <= N/2. Thus, we are done
•  » » » 9 months ago, # ^ |   0 Thank you, ChevishaUchiha.but, I'd like to know, why when we want to minimize sum a_i * b_i , we sort?For example, a=(2, 3, 5, 7) we have to pair(2, 7), (3, 5). But I can't understand why is this correct?
•  » » » » 9 months ago, # ^ | ← Rev. 4 →   0 Because you want to pair the largest one with the smallest one, next largest with next smallest, and so on. Since we are squaring each group having one group even slightly larger than it needs to be costs us much more than if we weren't squaring. e.g. (2+7)^2+(3+5)^2 == 9^2+8^2 == 145or try (7+3)^2+(5+2)^2 == 10^2+7^2 == 149See how we have an average of 8.5 in the first example terms and 8.5 in the second example terms, but because we are squaring its much better to have terms 8 and 9 to square as opposed to 7 and 10 to square. The terms have to be paired according to the question, makes no sense to make them groups of three or higher because every time you increase the square geometrically. So we know we are looking for pairs, and its best to keep the pair sums as close as possible. Think 10 and 1 vs 5 and 6, both sum to 11, but their sum of squares 5 and 6 is 61 and sum of squares 10 and 1 is 101. Do that for any sum you can think of, you will see the closer they are the better. Take 11:10^2 + 1^2 == 1019^2 + 2^2 == 858^2 + 3^2 == 737^2 + 4^2 == 656^2 + 5^2 == 61So how do you take an array of numbers and make their pairs as close as possible? You sort them, two pointers, one in front i and one in back j. Sum and square front plus back, increment front, decrement back, while i
•  » » » » 9 months ago, # ^ | ← Rev. 2 →   +3 Search for rearrangement inequality. It's simple to prove, intuitive and quite useful.Basically, it states that if ai and bi are permutations of 2 sequences of real numbers, then the sum ai*bi will be minimized when ai and bi are oppositely sorted and will be maximized when they are similarly sorted.Intuitively, if you want to purchase some items from a store, such that you want ai objects having price pi, then to minimize the total cost, you want to buy the costliest item as less times as possible and so on. So, if prices pi are increasing, then ai must be decreasing.
•  » » » 9 months ago, # ^ |   0 I understood the second proof by reading about proof og Rearrangement Inequality. But couldn't understand your proof for 1st part — having only groups of size 2. Can you please elaborate why only groups 2 will lead to optimal solution?
 » 9 months ago, # | ← Rev. 2 →   0 In the last part of problem F, there is no need to use extended euclidean algorithm to find a solution. Let's assume we want to find X such that Such a number X exists only if y is divisible by gcd(n,  p  -  1). If yes, then we can reduce the fraction to . Obviously now, is invertible mod(P  -  1) since they are co-prime, and n - 1  =  nphi(p  -  1)  -  1
 » 9 months ago, # |   0 For problem E,which should be the times at which Alice will disturb for test 3? I can't find any combination in which he only gets 11 coins.
•  » » 9 months ago, # ^ |   0 Bob collects 4 coins at time 1, collects 7 coins at time 6, Alice disturbs at time 11 and 12.
 » 9 months ago, # |   0 Can anybody explain how is answer for testcase3 = 11 for Div2E?
•  » » 9 months ago, # ^ |   0 Bob collects 4 coins at time 1, collects 7 coins at time 6, Alice disturbs at time 11 and 12.
•  » » » 9 months ago, # ^ |   0 Thanks missed "after that" in statement : If Bob chooses to collect the coins in the i-th red envelope, he can do it only in an integer point of time between si and ti, inclusive, and he can't collect any more envelopes until time di (inclusive) after that.
 » 9 months ago, # |   0 Can someone please help me fix my solution for problem E 49335045 I get WA on test 10
•  » » 9 months ago, # ^ | ← Rev. 3 →   +5 You shouldn't use LONG_MAX because LONG_MAX = 2 ^ 31 — 1. Try using 1e18.UPD AC with #define LONG_MAX 1e18 — 49360125
•  » » » 9 months ago, # ^ |   +1 Or use LLONG_MAX instead of LONG_MAX.
•  » » » 9 months ago, # ^ |   0 Thank you very much! I am new to c++ so this helped me a lot.
 » 9 months ago, # | ← Rev. 2 →   +3 Hi, everybody! Please allow me to advertise my unofficial Chinese editorial of this round: Codeforces Round #536(Div.2)For problem C, I think author's proof may be incomplete (or just lack of detailed explanations):If bi and ci are settled, we can simply use Rearrangement Inequality to pair them.But why must bi and ci be {a1, a3, a5, ..., an - 1} and {a2, a4, a6, ..., an} ?My proof to this detail:Any such pairing ({bi}, {ci}) can be "doubled" and be come a complete pairing between {ai} and {ai} .For example: for 1 2 3 4 5 6, a pairing (3,1) (2,4) (5,6) can be seen as 1 2 3 4 5 6 3 4 1 2 6 5 so a pairing can be represent as A , a complete pairing can be represent as B = f(A) (note that B = f(A) always exists but not A = f - 1(B)).ThenThuscost(Ai) ≥ cost(A * )Q.E.D.
 » 9 months ago, # |   0 For 1st part of problem E, how to include the condition for d(till when other envelopes can't be collected)?
 » 9 months ago, # |   0 How to solve B ?
 » 9 months ago, # |   0 In Problem F , Can anyone explain more about h_k ? and how can I obtain it from matrix exponentiation using linear recursive equation ?
 » 9 months ago, # | ← Rev. 6 →   0 Does problem F have a simpler solution?Let's first say that f_i is a product of some powers of f1, f2,..., fk. This is true for all i. We can then consider the recurrence as an additive recurrence over k dimensional vectors f_i = b1*f_i-1 +... +bk*f_i-k. We are basically considering a "logarithmized" version of the recurrence.Then we can have a transition matrix M of size k x k to get from f_i, f_i+1,...,f_i+k to f_i+k+1,f_i+k+2,...,f_i+2k.We then use fast exponentiation with matrix multiplication to get from f1...fk to fn (mod p-1 for values). The result will be that we will have fn expressed as a product of powers of f1...fk. We will use again fast exponentiation on numbers now to compute the values for the powers of f1..fk-1. We multiply fn by the inverse of this product and we get fk^b = a (mod p). Finally we are left with just computing the b-th root of a (mod p). Final complexity should be O(k^3*log n + finding discrete b-th root). Does this make any sense to you? LATER EDIT: I just realized that this is more or less what the Tutorial also proposed.
 » 9 months ago, # |   0 Hi,can you tell me the test of 7 on Problem B? i wrong answer on it long time
 » 9 months ago, # |   0 Can Somebody help me in Problem E. I am getting TLE in testcase #13 I am using similar approach to this comment https://codeforces.com/blog/entry/64928?#comment-488863
 » 9 months ago, # |   0 Solve this linear equation in or if you apply Fast Fourier Transform. In this equation, the mod number is 998244352 which doesn't have primitive root. You can't optimize it with NTT. I think the fastest solution should be instead of .
•  » » 9 months ago, # ^ | ← Rev. 7 →   0 In fact, for arbitrary modulus (not very large) NTT, there is a trick called three-modulus-NTT (translated from Chinese). Suppose that we want to get . The intuition is that the coefficients for the answer polynomial C(x) = A(x)B(x) won't exceed nP2, where n is . Thus we choose 3 NTT-friendly modulus (whose multiplication is greater than nP2) to get the results and apply Chinese Reminder Theorem to retrieve the original answer back. The details can be found in some Chinese blogs (I'm sorry that I haven't found any in English).
 » 9 months ago, # | ← Rev. 2 →   +5 I think maybe the complexity of BSGS could be reduced to .In number-theory part, if we search for an x satisfying instead of , we have , so we don't need to get inversion modulo p which takes time.In data-structure part, maybe we can use unordered-map instead of map, then the total complexity is (although I have never implemented it before)
 » 8 months ago, # | ← Rev. 2 →   0 .
 » 6 months ago, # |   0 Could someone explain why in problem D sorting all the adjacency list and then using Dfs as it will always traverse the lowest nodes first gets a wrong answer? here is my code https://codeforces.com/contest/1106/submission/53541920
•  » » 3 months ago, # ^ | ← Rev. 3 →   0 You will understand your mistake if you try this case 4 3 1 2 1 3 2 4 The mistake is we do not want to specifically use dfs or bfs, just a pq will do.
 » 4 months ago, # |   0 Can anyone please explain how the state has been reduced in problem E.