### AhmedSoliman's blog

By AhmedSoliman, 23 months ago, ,

Hello, Codeforces!

I'd like to invite you to Codeforces Round #465 (Div. 2) which takes place on Monday, 19 February 2018 at 19:35 MSK. The round will be rated for division 2 participants. However, as usual division 1 can take part out of competition.

The round is prepared by my friends Kammola, Ahmad_Elsagheer, MostafaAbdullah and me (AhmedSoliman). Besides, many thanks to 300iq, mike_live, Arpa, GreenGrape and neckbosov for testing the round, KAN for coordinating the round and MikeMirzayanov for the great Codeforces and Polygon platforms.

You will be given 6 problems and 2 hours to solve them. The scoring distribution will be announced later. Good luck!

UPD1: Scoring is 500 — 750 — 1250 — 1750 — 2250 — 2750

UPD2: Congratulations to the winners!

#### Division 2 :

UPD3: The Editorial is available now!

Thank you everyone!

• +480

 » 23 months ago, # |   +26 a bit late for Chinese users.
•  » » 23 months ago, # ^ | ← Rev. 2 →   +1 Yes. It's late for me and I will fell a bit tired during this contest.
•  » » 23 months ago, # ^ | ← Rev. 5 →   0 I'm Chinese,too.it's too late
•  » » 23 months ago, # ^ |   +11 have to stay up late again :)
•  » » 23 months ago, # ^ |   +26 I slept for it at noon
 » 23 months ago, # |   +45 It is raining contests!!!
•  » » 23 months ago, # ^ |   +8 5 rated contest in 6 day :))
•  » » » 23 months ago, # ^ |   +45 and after this, 6 days without contests :))
•  » » » » 23 months ago, # ^ |   +14 and after this, there will be Codeforces Round #466(a rated contest) :))
•  » » » » » 23 months ago, # ^ |   +22 and after this there will be the ladder of "after"'s
•  » » » » » » 23 months ago, # ^ | ← Rev. 2 →   -6 and after this what will happen? :P
•  » » » » » » » 23 months ago, # ^ | ← Rev. 2 →   0 after this or after after this comment, new reply thread won't be created anymore
•  » » » » » » » » 23 months ago, # ^ |   0 :P
•  » » 23 months ago, # ^ | ← Rev. 2 →   +23 For me, it was more like a storm, losing 224 points in 6 days! :D
 » 23 months ago, # |   -24 when rating revious 2 contest
 » 23 months ago, # | ← Rev. 4 →   -32 At last,an usual contest time
 » 23 months ago, # | ← Rev. 3 →   -46 So many writers/testers/coordinators for a div.2 contest! What I mean is that I do appreciate the effort put on this contest and do not mean anything in a negative way.
 » 23 months ago, # |   -28 Once again, the purple problem setter.
 » 23 months ago, # | ← Rev. 2 →   +19 CODEFORCES is on fire ..!!!
•  » » 23 months ago, # ^ |   0 it's kind a contest storm !
 » 23 months ago, # | ← Rev. 5 →   +2 Unfortunately, I misread the C problem, I passed 4 problems, but the score is very low, I did not have the chance to have the first time to make 5 problems T.TIt seems that I need more practice.Look forward to the next contests
•  » » 23 months ago, # ^ |   0 What's your approach for E?
•  » » » 23 months ago, # ^ |   -24 Centroid decomposition on the complement graph.
•  » » » 23 months ago, # ^ | ← Rev. 8 →   -15 ......
 » 23 months ago, # |   +23
•  » » 23 months ago, # ^ | ← Rev. 3 →   +8 It is time to crush it!
•  » » » 23 months ago, # ^ |   0
•  » » 23 months ago, # ^ | ← Rev. 2 →   +9
 » 23 months ago, # | ← Rev. 2 →   -39 The Announcement is 8 days before the contest. Lets hope the scoring will be announced early like the announcement.UPD: It wasn't in the main page
•  » » 23 months ago, # ^ |   +1 It's before 23 hours :P
 » 23 months ago, # |   +37 GUC D:
•  » » 23 months ago, # ^ |   +16 3aaa4 GUC
•  » » 23 months ago, # ^ |   +12 Who is GUC? Where is GUC?
•  » » » 23 months ago, # ^ |   +16 German University in Cairo
•  » » 23 months ago, # ^ |   +1 lots of math xD
 » 23 months ago, # |   +2 Good luck
•  » » 23 months ago, # ^ |   0 hey,I know who you are also I saw you at PST
 » 23 months ago, # |   +20 Codeforces is smashing , it is going wild , i think today or tomorrow there will be something named "contest overflow"...
 » 23 months ago, # |   +16 Hope it will be a bit harder than the last one
•  » » 23 months ago, # ^ |   -19 Agree! Hope problem statements are not long or thick, but hard.
 » 23 months ago, # |   +74
 » 23 months ago, # |   +44 Hate geometry :(
 » 23 months ago, # |   +73 More like Mathforces today.
 » 23 months ago, # |   +81 One more task and this would have been a beautiful regular round with two divisions.
•  » » 23 months ago, # ^ |   +15 Yes, the problemset is so good.
 » 23 months ago, # |   +27 Hackless Round!
•  » » 23 months ago, # ^ |   0 Nonetheless, I hacked one solution in my room)
 » 23 months ago, # |   -6 I think there has been some work on making problems more shitty than they were like in problem E
 » 23 months ago, # |   +135
•  » » 23 months ago, # ^ | ← Rev. 2 →   +9 Try this test case 1 0 0 0 0It should output 0.5 0 0.5 Actually the circle can be anywhere, but exactly 0.5 away from the origin.
•  » » » 23 months ago, # ^ |   0 Any ideas for pretest 5?
•  » » » 23 months ago, # ^ | ← Rev. 3 →   -18 "R, x1, y1, x2, y2 (1 ≤ R ≤ 105, |x1|, |y1|, |x2|, |y2| ≤ 105)"The test case is invalid.And mine printed "0 0.5 0.5"
•  » » 23 months ago, # ^ |   0 So True! Someone knows what was the preset 4?
•  » » 23 months ago, # ^ | ← Rev. 2 →   +10 It seems that in the fourth pretest we get (x1,y1) = (x2,y2).
•  » » 23 months ago, # ^ |   0 Something like 2 4 4 4 3.
•  » » 23 months ago, # ^ |   +1
•  » » » 23 months ago, # ^ |   0 killer_god Hahaha !!!
•  » » 23 months ago, # ^ | ← Rev. 2 →   0 Geometry is tough
 » 23 months ago, # | ← Rev. 2 →   +2 A lot of problem C gonna hack this contest
 » 23 months ago, # |   +3 Note: Sorry for my bad english.So, at Problem C the ideea is to find the radius of the biggest circle Which has the laptop point and doesn't exceed the flat Area. This is relative simple The radius is (R+sqrt((x1-x1)^2+(y2-y1)^2))/2; But.. How can I Find the center of this Circle? That is the question. :)
•  » » 23 months ago, # ^ | ← Rev. 4 →   +3 Required radius The center will be the point at above calculated distance r in the direction of (x1, y1) from (x2, y2).Let P1 = (x1, y1), P2 = (x2, y2) and . Then center should be at .Handle the P2 outside apartment and P1 = P2 cases separately.
•  » » 23 months ago, # ^ |   +5 Find distance from laptop to center of the given circle. That plus the radius will give the diameter of the circle you want. The center of this circle will be at the midpoint of this line, which you can find with a bit of trig or by using ratios
•  » » 23 months ago, # ^ |   0 That's where I was stuck too.. You get the equation X^2 + y^2 — 2(x + y) = 7 and h^2 + k ^ 2 — 2h — 2k = (radius ^ 2) — 2Where x and y are any points, on the bigger circle, and the "new" fifa circle. h and k are centers of new fifa circle. That's as far I went with that problem !
•  » » 23 months ago, # ^ |   0 you can use some maths let center of flat to be (0, 0)phi = atan2(y2, x2)x3 = -R * cos phi y3 = -R * sin phi(x2, y2) — (x3, y3) is diameter of circle you need.
•  » » 23 months ago, # ^ | ← Rev. 2 →   0 My approach was so: // find distance from Fafa to center of flat fcd = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); // find radius of AP rap = (r + fcd) / 2; // find cos and sin of the vector pointing from Fafa to center of flat cs = (x1 - x2) / fcd; sn = (y1 - y2) / fcd; // add projections on x and y axis of AP radius pointed on that ray to Fafa coordinates xap = x2 + rap * cs; yap = y2 + rap * sn; 
•  » » » 23 months ago, # ^ |   0 x2+ or — rap*cs? And y2, too...?
•  » » » » 23 months ago, # ^ | ← Rev. 3 →   0 xap = x2+rap*cs, yap = y2+rap*sn, as sin and cos has signs corresponding to direction of vector Fafa->AP. It works OK: http://codeforces.com/contest/935/submission/35499555
 » 23 months ago, # |   0 how to solve c?
 » 23 months ago, # | ← Rev. 2 →   +1 Someone can explain how to do the C problem? How can I maximize the area of the circle? My only thoughts was achieving this by some binary search...My general ideas all surrounded something like that: if Fafa's laptop is outside or at some flat's end, then the answer is all flat's area. If not, then choose the center whose maximize the area. This is the right way to do?
•  » » 23 months ago, # ^ |   +3 you have a line which connects fefa and the room center. extend that line. find the point on the line which lies on the circumference call this P. your coordinates -> midpoint of P and fefa. radius is the distance b/w them — 0.000001~.
•  » » 23 months ago, # ^ |   0 Even though I got hacked, I think I have the right idea.Let point a be centre and b be point where laptop is. The answer radius is obviously (r+dist(a,b))/2. You can also get distances from the center and the laptop, which are (r+dist(a+b))/2 and (r-dist(a,b))/2 respectively. Then you can apply external form of section formula to get the coordinates of the center.
•  » » 23 months ago, # ^ |   +16 Here is my approach.First of all, if Fafa is on the border of the flat or outside of the flat, Fifa can place the access point at the center of the flat, and set the radius exactly equal to R.If not, we can see that the biggest area will be something like this:To obtain such an answer, at first we have to find the other vertex of the orange segment (one vertex is Fafa's laptop location). We can calculate that through geometric vectors.After that, we can obtain the access point's location: it will be the midpoint of the orange segment. The radius will be half the length of that segment.
•  » » » 23 months ago, # ^ |   +4 Well, more simple than i thought. I drew some drafts like yours but could not realize how to find the position of the second vertex. Thanks!
•  » » » 23 months ago, # ^ |   0 Can the boundary of our circle pass through fafa's location?
•  » » » » 23 months ago, # ^ |   0 Yes. The 2nd sample test confirmed that ;)With the input 10 5 5 5 15 and the output 5.0 5.0 10.0, we can see that: Fafa's laptop is right on the boundary (its distance to the center is 10, which is equal to the flat's radius). The flat's circle and the correct access point's circle are equivalent. Therefore, the access point's boundary can pass through Fafa — and he still gets no coverage at all.
•  » » » » » 23 months ago, # ^ |   0 Ok cool,...I submitted and I was afraid about this case..
•  » » » » » » 23 months ago, # ^ | ← Rev. 2 →   0 Same to me. I even had to use plotting program to make sure that it lied on the boundary, though it could be calculated algebraic-ly. :P
•  » » » 23 months ago, # ^ |   0 That feeling, when you are solved the problem C by binary and ternary search... http://codeforces.com/contest/935/submission/35499682
•  » » 23 months ago, # ^ |   0 to maximize the area of the circle you have to maximize it's radius, to do that you have to find the 2 intersections of the line determined by the points (x1,y1) and (x2,y2) with the circle of center (x1,y1) and radius r, this is some quick maffs, after that you have to find which of these 2 intersections is further away from (x2,y2), again quick maffs, after that you have to deal with all the annoying cases when points (x1,y1) and (x2,y2) coincide, when x1=x2, and so on.
 » 23 months ago, # |   +122 Fifa and Fafa? Really? What about Fofa? And Fafi? And...Joke aside, it's usually better to have easy to differ names (e.g. Alice and Bob). Otherwise it can be really hard to follow the problem statement while remembering who is who.
•  » » 23 months ago, # ^ |   0 Well, that is why it wasn't required to remember their names. :P
•  » » 23 months ago, # ^ |   +4 yeah, i get confused by C problem, because they have similar name.
•  » » » 23 months ago, # ^ |   +5 Yeah, I was confused why doesn't he wants his own laptop to get the wifi. Weird fifa dude.
 » 23 months ago, # |   +4 Does anyone know what test 6 D would look like?
•  » » 23 months ago, # ^ |   0 wtf pretest 6 don t love me also 7 submission too badd
•  » » 23 months ago, # ^ | ← Rev. 2 →   0 I have WA6 in D. I have forgotten put some code in else block, so when s1[i] = s2[i] = 0, my solution changed ans twice So i think there is such i that s1[i] = s2[i] = 0
•  » » 23 months ago, # ^ | ← Rev. 2 →   0 Edit: nvm lol
 » 23 months ago, # |   0 Hi, how to solve E?I have a solution if there has no constraint of P & M, that is: Greedily choose '+', but if expression satisfies |E1 — E2| > |E1 + E2| and it's not leftmost expression, choose '-', such that the answer is optimal.But I have no idea about with constraint of P & M.
•  » » 23 months ago, # ^ | ← Rev. 2 →   +3 Use dynamic programming. hi[i][j] is the maximum value of the ith expression with j pluses used within it lo[i][j] is the minimum value of the ith expression with j pluses used within it Transition states are relatively straightforward, but it is a bit tricky to implement the dp order correctly. Final complexity is O(E2).
•  » » » 23 months ago, # ^ |   +5 thanks a lot!
 » 23 months ago, # |   0 can someone tell me why my approach for d is wrong https://ide.geeksforgeeks.org/TGNpoGcVTH
•  » » 23 months ago, # ^ |   0 Dat test: 3 20 1 01 2 1 In first position you can write just 2. Then whatever what you write in third position. So real P / Q = 1 / 2 and ans is 5000000004 while your answer is 750000006
•  » » » 23 months ago, # ^ | ← Rev. 2 →   -6 ohh god! fuck me!!! just forgot to include if(a[i] < b[i] && a[i] != 0) break;
•  » » 23 months ago, # ^ |   0 Not sure if the approach is wrong or not but there is atleast a overflow.
•  » » » 23 months ago, # ^ | ← Rev. 2 →   +6 There is no overlow since #define int long long 
•  » » » » 23 months ago, # ^ |   +10 oh god
•  » » 23 months ago, # ^ |   0 The first what I saw is that in your power function long longs are missing (t*t can overflow).
 » 23 months ago, # |   +76
•  » » 23 months ago, # ^ |   +19 Or throw his laptop against the wall. Problem solved!
 » 23 months ago, # |   -72 I think the problems are sorted by how shitty they are but then I think about problem C and how awful it was to implement.
•  » » 23 months ago, # ^ |   +31 C wasn't particularly hard to implement for a geometry problem. There was only one extra case to take into consideration: (x1, y1) = (x2, y2). Other than that, the implementation was relatively clean.
•  » » » 23 months ago, # ^ |   -68 The whole idea of geometry problems are shitty and awful
•  » » » 23 months ago, # ^ |   0 Apparently, Fafa's laptop can be outside the Flat too. Test case 3 shows this. This is another case I guess. Personally I felt the problem had incomplete information/ is misleading. Why say that Fifa and Fafa share a flat together when Fafa's laptop can be outside the flat?
•  » » » » 23 months ago, # ^ |   +5 The problem specifically states The flat is centered at (x1, y1) and has radius R and Fafa's laptop is located at (x2, y2), not necessarily inside the flat. Plus, there is that test case. There was absolutely no ambiguity.
•  » » » » » 23 months ago, # ^ | ← Rev. 2 →   0 I understood that. All I was saying is it was said Fafa and Fifa share a flat in the problem. Many people misunderstood this as Fafa always stays inside the room.UPD : It is mentioned in problem that Fafa's laptop is not necessarily inside the flat. I guess I missed it.
 » 23 months ago, # |   +12 I think some drawing would have made C easier to understand :\ Anyway, nice problem and problemset also, thanks :D
 » 23 months ago, # |   +2 Spent half of my time minimizing the 'uncovered area' which not at all required. And like ale64bit said, assumed Fifa and Fafa as Fifa. Problems were good but statements could have been made better.
 » 23 months ago, # |   +87 Wow, I'm impressed. The problems included some interesting Egyptian background, which I enjoyed. The last problem was tricky for me, and I spent much time thinking, fixing the code and analysing special cases. Personally, I had a great time. Thank you very much!
 » 23 months ago, # |   -126
•  » » 23 months ago, # ^ |   +67 The problems were excellent.We didn't perform well doesn't imply that the problems were bad.
•  » » 23 months ago, # ^ |   +1 Problems were of a good quality. Only I didn't like the naming convention of Fifa and Fafa :D
 » 23 months ago, # |   0 Can someone please tell me what's wrong with this solution to D : link?
•  » » 23 months ago, # ^ |   0 in first else if it should be a[i] < b[i] in solve() I think?
 » 23 months ago, # |   0 Finding centre of the circle after finding the required radius can be done by the sector for external divison in problem C(handling corner cases differently)
 » 23 months ago, # |   0 For problem D:P is number of valid changes, Q is the number of all changes. The result is P/Q mod MOD ...How to calculate P/Q mod MOD ? I thought about modular multiplicative inverse but I couldn't implement it...
•  » » 23 months ago, # ^ | ← Rev. 3 →   +11
•  » » » 23 months ago, # ^ |   0 What exactly is M ?
•  » » » » 23 months ago, # ^ | ← Rev. 3 →   0 M is the mod, which is 1000000007. Since M is a prime, φ(M) = M - 1.
•  » » » » » 23 months ago, # ^ |   +1 So I should first calculate RES = Q^-1 your way and fast exponentiation and then print P*RES mod MOD ?
•  » » » » » » 23 months ago, # ^ |   0 Yes, that's correct
•  » » » » » » » 23 months ago, # ^ |   0 Yup, thanks a lot :)
•  » » » 23 months ago, # ^ |   0 But wait,if you do it that way, it means that the answer is going to be just Q^(mod-2) * P and it is not necessarry for those 2 to be co-prime. Then it won't work. For example for sample 3 the answer is 16*25*24*23 / 26*25*24*23 . So we need to find the modular inverse for 26*25*24*23 and multiply it by 16*25*24*23 and output it %(1e9+7). If i do that in the 3 sample i get the wrong answer. We need an ireductible fraction, so how to get it?
•  » » » » 23 months ago, # ^ |   0 After getting P and Q divide them with gcd
•  » » » » » 23 months ago, # ^ |   0 How to divide P and Q by GCD if they, while being calculated, will be % mod because during the calculation there will be for sure values bigger then 10^18. So applying gcd so make it ireductible just doesn't make sense.
•  » » » » » » 23 months ago, # ^ | ← Rev. 3 →   +9 We don't actually need to divide by gcd because of how mod works. and that is unique
•  » » » » » » » 23 months ago, # ^ |   0 So what you're saying is that just by calculating the answer randomly and getting P%mod and Q%mod, then calculating Q^(mod-2) and multiplying by P we get the correct answer??
•  » » » » » » » » 23 months ago, # ^ |   +6 You don't even need to maintain p and q separately, just multiply by the inverse element every time you need a division.
•  » » » » » » » » » 23 months ago, # ^ |   0 sh** you are so right, thank u very much.
•  » » » » » » 23 months ago, # ^ |   0 Oh, that's true..
•  » » 23 months ago, # ^ |   +1 ll realMod(ll num, ll denom, ll MOD){ for(int i = 0; ; i++){ if((num + MOD*i) % denom == 0){ return (num + MOD*i) / denom; } } }
•  » » » 23 months ago, # ^ |   0 It's not working with the 3rd sample
•  » » 23 months ago, # ^ |   +1 P/Q mod MOD means we're looking at P*x mod MOD where x is the modular inverse of Q mod MOD, which means that Q*x mod MOD = 1. So, Find the modular inverse MI for Q mod MOD. P*=MI; ans=P%MOD;
•  » » » 23 months ago, # ^ |   0 Thanks :)
•  » » » 23 months ago, # ^ |   0 It doesn't work if you do that for the third sample, we need an ireductible fraction before we do the modular inverse thing, so p and q must be co-prime before applying modular inverse to Q.
•  » » » » 23 months ago, # ^ |   0 divide by gcd
•  » » 23 months ago, # ^ |   0 Another way to calculate it is to use the Extended Euclidean Algorithm, that is given a and b, find integers x and y such that ax + by = 1. If we set a = Q and b = M, then 1 = Qx + My = Qx (mod M), so x = Q^{-1} (mod M)
•  » » 23 months ago, # ^ |   0 BTW, if someone still looking for a more verbose answerhttps://en.wikipedia.org/wiki/Modular_multiplicative_inverse#Computation
 » 23 months ago, # |   +155
 » 23 months ago, # |   0 C?
 » 23 months ago, # |   0 Can someone explain what's wrong with my code for D? https://pastebin.com/TxuxzGJj
 » 23 months ago, # |   0 Can someone say if this method for problem E would work?lets say we process expressions in decreasing order of nesting.Dp[i][2] denotes the maximum and minimum value of that expression.So now we can make transition easily to lower nesting .Sorry if this question is too naive.
»
23 months ago, # |
Rev. 7   +19

Problem C using ratio and proportions

#### UPDATE (It is Correct)

There is nothing wrong with this solution. It is actually correct. As people below pointed out I didn't check for integer overflow and printed wrong variables. After I fixed that I got AC

•  » » 23 months ago, # ^ |   0 What if dist is 0?
•  » » » 23 months ago, # ^ | ← Rev. 3 →   0 I took care of the 2 other special casesCASE 1 : dist = 0 r = R / 2 xap = x1 + r yap = y1 print(xap, yap, r) CASE 2 : dist > R print(x1, y1, R) 
•  » » » » 23 months ago, # ^ |   0 Looks like overflow at line 50.
•  » » 23 months ago, # ^ |   0 Overflow ((x1 — x2) * (x1 — x2)). x1 and x2 both int. So (x1 — x2) * (x1 — x2) will be int. Bu Since |x| <= 10^5 -> (x1 — x2) ^ 2 <= 4 * 10^10 which doesn't fit in int-type.
•  » » » 23 months ago, # ^ | ← Rev. 2 →   +3 So my approach is correct but I dint check overflow ? :/ God DAMN it. I will have to check after the contest ends
•  » » » » 23 months ago, # ^ |   +16 When dist>R, you printed x1 and x2 instead of x1 and y1.
•  » » » » » 23 months ago, # ^ |   +26
 » 23 months ago, # |   0 Can someone please point out what is wrong with my code for C? http://codeforces.com/contest/935/submission/35496680
•  » » 23 months ago, # ^ | ← Rev. 2 →   0 Shouldnt this if((dist+r<=R)) be 2*R in the last if which do not have matching else? Edit: it passed with 2*R at both places
•  » » » 23 months ago, # ^ |   0 Thanks for your reply! But No, I think the condition was right (condition for a circle to be inside another circle), I found the mistake ,it should have been. if((dist+r-R)<=0.000001) It passed with this.
•  » » » » 23 months ago, # ^ |   0 Ah the epsilon. Cool.
 » 23 months ago, # |   0 Solved the first two problems as fast as I could.Then saw FIFA my eyes lit up :) but it took forever to actually get it AC.
 » 23 months ago, # |   0 The radius is the same as in the correct answer, why is it WA?
•  » » 23 months ago, # ^ |   0 Read carefully the task, your circle goes beyond the circumference of the flat
•  » » 23 months ago, # ^ |   0 WA because wi-fi would be accessed from point (-5 -10) which is outside appartment.
•  » » 23 months ago, # ^ |   +6 This is how it looksLink to Online Graph : https://www.desmos.com/calculator/b7at4hbbxb
 » 23 months ago, # |   0 Could someone explain how to do D?
•  » » 23 months ago, # ^ | ← Rev. 2 →   +2 Let P(x) be the probability that a[i] = b[i] for i < x and a[x] > b[x]. Then the answer is because probabilities. To find , we observe that , so we can just compute numerator and denominator mod M at each step.
•  » » » 23 months ago, # ^ |   0 https://ide.geeksforgeeks.org/g335Ycicx1 can you tell me what the problem in my solution i just use your idea
 » 23 months ago, # |   +15 Sadly my incorrect F passed systests. I incorrectly thought that the minimum difference would just subtract -1*diff instead of -2*diff during the contest and when the ranges are small I just passed through the whole range to get the best answer.301000 990 980 970 960 950 940 930 920 910 900 890 880 870 869 870 880 890 900 910 920 930 940 950 960 970 980 990 1000 10101 1 2 29 1000This case breaks my solution (it prints 2269 instead of 2268, it should choose the 869). http://codeforces.com/contest/935/submission/35492061 this is the wrong submission. This is a small mistake from me that usually wouldn't happen to anyone but I hope that the tests didn't impact any rating (the implication of this is that there's no big query where it's better to get an i where a[i — 1] > a[i] and a[i + 1] > a[i]).
 » 23 months ago, # | ← Rev. 2 →   0 Can some one please tell me what is wrong with my solution the radius i am getting in the test case 14 is correct but the checker comment reads "wrong answer Too large radius." link
•  » » 23 months ago, # ^ | ← Rev. 2 →   +1 You should output more digits after the decimal point for the x and y values, my guess is that there is some point on your circle that is outside the given circle by more than 1e-6.
•  » » 23 months ago, # ^ |   +1 just print more digits after the decimal point. e.gcout << fixed << setprecision(10) << x << endl;
•  » » » 23 months ago, # ^ |   0 Thanks bro after changing it to cout << fixed << setprecision(9) << x << endl it got accepted but in my previous submission i wrote cout<
•  » » » » 23 months ago, # ^ | ← Rev. 2 →   +7 The fixed specifies that you want the specified precision to be applied only after decimal point. without it, it'd just output a total of 9 digits, the first 9 from the left, regardless of whether the digit is after or before the decimal point.
•  » » » » » 23 months ago, # ^ |   0 Oh now i get it.Thanks
 » 23 months ago, # |   +5 I got confused by Fifa Fafa Fafa Fifa Fafa Fifa Fifa Fafa
•  » » 23 months ago, # ^ |   0 I got confused when they said flat has a radius.... I was imagining a rectangle :D
 » 23 months ago, # |   0 Can you please suggest what is wrong with this solution for problem D: https://ide.geeksforgeeks.org/el12hkWIU0 ?
•  » » 23 months ago, # ^ |   0 when you did this:if (!a[i] && !b[i]) r = (m * solve(a, b, i+1) + m*(m-1)/2) % MOD;the denominator should change to m*m but at the end you are still dividing by m only.
•  » » » 23 months ago, # ^ |   0 Indeed, thank you!
 » 23 months ago, # | ← Rev. 3 →   0 Hi, I submited a code (35493900) in the contest for problem c and it gave Idleness limit exceeded!!! but after the contest I submited the same code (35503114) and it was accepted!!! I was wondering if you could fix this problem and fix my score !!!!!!!!!!!
•  » » 23 months ago, # ^ |   0 Fixed. AC already.
 » 23 months ago, # |   +21 I got the message below after competing in this round. I did not cheat or attempt to cheat during the contest. Furthermore, I worked locally on my own computer. Could you please take a look at this issue? The odds of submitting a very similar code for a div 2 A problem are rather high. Thanks!Attention!Your solution 35483271 for the problem 935A significantly coincides with solutions HSNBRG/35477249, wertzu/35483271. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://codeforces.com/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties.
•  » » 23 months ago, # ^ |   +3 It's a good idea to tag MikeMirzayanov to get his attention.
 » 23 months ago, # |   +34 Random observation regarding test data in problem F:solution which says "OK, in case there is local maximum — let's pick it, otherwise let's check all possible moves in O(N) per query" passes easily without any additional tricks or optimizations. 35497796 is an example (obfuscated though, since it was originally an attempt to code correct solution).
•  » » 23 months ago, # ^ |   +3 http://codeforces.com/blog/entry/57702?#comment-415778 so far it's been at least 2 solutions affected by this :|
•  » » » 23 months ago, # ^ | ← Rev. 2 →   +8 In your solution you at least say "when the ranges are small". Mine is simply "screw it, YOLO, let's try them all" :) On an unrelated note: while my solution to E from the contest failed because I forgot to check if P>100, solution in upsolving passes with wrong check containing < instead of <=. It isn't going to work well for a case with P>100, M=100.
 » 23 months ago, # |   0 awesome C :)
•  » » 23 months ago, # ^ |   +23 really?
 » 23 months ago, # |   0 I think I can get up,but...
 » 23 months ago, # |   +2 A bit late for coach Marcil!
 » 23 months ago, # |   +8 F problem. I think we should add such data. 52 3 1 1 1 52 5 5 22 3 4 31 4 4 11 3 5 21 1 1 1
 » 23 months ago, # | ← Rev. 2 →   0 Can someone please tell me what's wrong with the following approach for problem D? :For each i, I find the number of ways that all the letters upto i - 1 are the same, and a[i] > b[i].Then, the number of ways for each index is p = x * pow(m, unknown[i + 1]) where x is the number of possibilities of a[i] > b[i], with different possible conditions, and unknown[i + 1] is the count of erased numbers in either a or b, from i + 1, to the end.Also, I multiply to p, pow(m, bothZeroes), where bothZeroes is the number of indices up to i - 1, at which a[i] = b[i] = 0, because any 1 of the m numbers could be chosen for such indices.But, I looked into this code, and he hasn't multiplied the pow(m, bothZeroes) part to his answer. What's wrong with my approach, and how come the m^bothZeroes` part isn't required?Link to solution.Will be glad if someone could help. Thanks in advance.Edit : p is not the probability, it's the numerator part.
 » 23 months ago, # | ← Rev. 2 →   0 i read problom d for last 1 hours still can't understand what it says :(
 » 23 months ago, # |   0 why i am getting denial of judgment for problem A ?
 » 23 months ago, # |   0 why fifa and fafa ???? can't you use good names ??? i got confused while reading the statement , fifa.. fafa.... fafa... fifa.... what the hell