### MikeMirzayanov's blog

By MikeMirzayanov, 3 weeks ago,

• +70

 » 3 weeks ago, # |   +37 That trick for pairs in problem M is just awesome... During the whole contest we were struggling to remove that logn factor but couldn't find the way.
•  » » 3 weeks ago, # ^ |   -84 https://codeforces.com/contest/1468/submission/102338964 Can you tell why this is giving runtime error in test 46 I am not able to figure it out..
 » 3 weeks ago, # | ← Rev. 2 →   -18 Nice editorial
 » 3 weeks ago, # |   -17 Thanks for this Tutorials, It was a very cool contest, But there were a lot of test cases, which caused the long queue.
 » 3 weeks ago, # | ← Rev. 2 →   -8 I think that there is a mis-written part in problem A in editorial: a[posi−1]≤a[posi]≥a[posi+1] should be a[posi−1]≤a[posi]≤a[posi+1]
•  » » 3 weeks ago, # ^ |   +6 i can not understand editorial for A. can you explain?
 » 3 weeks ago, # |   -8 I think there is an error in tutorial for L. "If there are no more than 2 such integers" (second sequence) should be "If there are no more than 1 such integers" or "If there are less than 2 such integers". Because in next paragraph $k_i > 1$ implies that $p$ can be important if there are 2 numbers of form $p^q$.
•  » » 3 weeks ago, # ^ |   -8 Yes, you are correct. Thank you!
 » 3 weeks ago, # |   -38 MikeMirzayanov is there an alternate to these explanations , it is difficult for me to understand this editorial.
 » 3 weeks ago, # |   -12 Please someone can explain similar sets(problem M) editorial.
 » 3 weeks ago, # | ← Rev. 5 →   -21 Thanks for good problems
 » 3 weeks ago, # |   0 for problem c, i just used two different sets, one for each operation type, sorting elements as either (i, m) or (m, i), where m is the estimated money and i is the customer number. this makes finding which customer is served much easier, as you can take from the front of the first set for the 1st operation and from the back of the second set for the 2nd operation
 » 2 weeks ago, # | ← Rev. 2 →   +3 For M, how is finding all pairs (x,y) not time complexity (k^2)? How exactly do you create a separate array for each integer x and then add all values y to it
 » 2 weeks ago, # |   0 For L, I'm getting wrong answer on test case 99 (because I'm only able to find a sequence of 994 items, not 1000). Is this happening to anyone else?
 » 13 days ago, # | ← Rev. 2 →   0 In problem C Berpizza why I am getting tle on test case 12 My code please let me know and also how to resolve it
•  » » 5 days ago, # ^ |   0 I notice that you are sorting the vector every time a monocarp or polycarp query is done. This is probably making it slow. You can instead try using sets as they are implemented using binary-search trees and will be faster (O(log n) vs O(n logn) per query). My submission using sets
•  » » » 4 days ago, # ^ |   0 Thanx. Now it was all clear to me
 » 11 days ago, # |   0 In problem M's tutorial, does it mean that: For every small sets, we find all pairs, which is O(k^2) where the k is the size of the sets. There are M/k sets so that their are O(M*k) pairs in total? How should I implement it? I tried 2 dimension unorderedmap but TLE.
 » 11 days ago, # |   0 Can anybody share the code of C. Berpizza
•  » » 9 days ago, # ^ |   0 See in my submissions
•  » » 4 days ago, # ^ |   0 #include using namespace std; typedef long long int ll; typedef vector vi; typedef vector> vvi; typedef vector vb; typedef pair pii; #define fo(i,s,e_ex) for(i=s;i=n;kb.second; } return a.first, decltype(&compForPair)> poly(compForPair); priority_queue > mono; cin>>q; while(q--){ cin>>type; if(type==1){ cin>>m; poly.push(mpp(m,guestNo)); mono.push(guestNo); guestNo++; }else if(type==2){ while(true){ ll gtorem = mono.top();mono.pop(); if(guest[gtorem]==1){ cout<>t; for(ll i=1;i<=t;i++){ solve(i); } return 0; }