Arpa's blog

By Arpa, history, 18 months ago, ,

Hi!

I'm honored to invite you to Codeforces Round #432, it will be held on 4th September 14:35 UTC. There will be 5 problems for each division, as usual, you have 2:30 to solve the problems. The contest was prepared by Lewin Lewin Gan, Artsem Arterm Zhuk and me.

The IndiaHacks Final Round will be held on 3rd September 12:30. Finalist must not discuss the problems after their contest.

The stories of my problems will be about Arpa, although in one problem you'll see Mojtaba Moji FayazBakhsh, my great teacher.

I'd like to thank Lewin, Artsem and myself (:P) at first, then Konstantin zemen Semenov and white2302 for testing the problems, Nikolay KAN Kalinin for helping us in moving the contest to codeforces and Mike MikeMirzayanov Mirzayanov for the great Codeforces and Polygon platforms.

The scoring distribution will be announced later.

Obviously, if you are interested in if the round is rated or not, ask in comments and get a lot of down votes.

UPD. There will be 5 problems for div.2 and 6 problems for div.1.

UPD2. Scoring Distribution: div.1: 500-1000-1250-1750-2000-2500, div.2: 500-1000-1500-2000-2500.

UPD3. Editorial is partially ready. I'll complete it soon.

Congratulations to winners:

Div.1:

1 . AngryBacon

2 . dreamoon

3 . sd0061

4 . W4yneb0t

5 . Um_nik

Div.2:

1 . miaom

2 . fzzzq2002

4 . _Lucas97 and Szymanski_w (WoW !!)

Official results

•
• +187
•

 » 18 months ago, # |   -445 Obviously, if you are interested in if the round is rated or not, ask in comments and get a lot of down votes.is it rated ? :))))))
•  » » 18 months ago, # ^ |   -317 wtf ? Just about 60 down votes ? :|I want to ~100 or ~200 :D
•  » » » 4 months ago, # ^ |   0 You did it bro. ;D
 » 18 months ago, # | ← Rev. 2 →   +92 4nd September 14:35 3nd September 12:30 Didn't know September had an extra "thirnd" and "fournd" days :)
•  » » 18 months ago, # ^ |   -29 Thanks. Fixed.
•  » » » 18 months ago, # ^ |   +118 and now we have 3th September ??
•  » » » » 18 months ago, # ^ |   -51 Thanks. Fixed.
 » 18 months ago, # |   -93
 » 18 months ago, # |   -34 WTF? Just say that the contest is rated. It's not a place for your stupid jokes. There are new users don't know if it is F**king rated or not!!! Hope statements are not s**t like your announcement.
•  » » 18 months ago, # ^ |   -7 Hah all those glass-hearted suckers downvoting me.
 » 18 months ago, # |   -17 So unusual time for contest
•  » » 18 months ago, # ^ |   -21 Sorry, didn't notice UTC, thought it is Moscow time
 » 18 months ago, # |   +28 If its rated than Cool and if not also Cool . But you should have said if its rated or not in ur blog post.
•  » » 18 months ago, # ^ | ← Rev. 2 →   -17 Yes I though it was unrated because it was based on a contest that happened before which could cause a leak of problems.
 » 18 months ago, # |   +43 I missed the round (HE India Hacks Finals) :( It seems that the time in codeforces calendar is wrong.
•  » » 18 months ago, # ^ |   0 Oh no, I'm very sorry about that, I forgot to update it :(
•  » » » 18 months ago, # ^ |   -6 Darn, forgot to check it was 12.30 UTC time. Should have got a notification at the beginning of the round :(
•  » » » 18 months ago, # ^ |   -6 I also missed the round on Hackerearth and didn't registered for it too. So can i participate in cf round?
•  » » » » 18 months ago, # ^ |   0 Yes, this is fine. We have a list of people who opened the contest, so you should be able to compete as long as you didn't open the problems.
 » 18 months ago, # |   0 Thanks for the contest. Indiahacks final sounds pretty tough. Will the difficulty be of a normal round?
•  » » 18 months ago, # ^ | ← Rev. 2 →   -53 A bit harder than a normal round.
•  » » » 18 months ago, # ^ |   +26 just a bit harder?
•  » » 18 months ago, # ^ |   +8 Of course, the high rated orange gets upvotes for sarcastic comment while everyone else gets downvoted to hell.Amazing community we have here.
 » 18 months ago, # |   -69 Is it rated?
 » 18 months ago, # |   +36 I hope to be specialist in the 50th contest for me :) Good Luck for everyone :)
•  » » 18 months ago, # ^ |   0 dude, you don't know whether or not, it's gonna be rated!
•  » » » 18 months ago, # ^ |   0 Pretty sure it's just like a normal contest, other than difficulty.
•  » » 18 months ago, # ^ |   -9 good luck newbiex
 » 18 months ago, # |   -18 Great contest with a great rank for me, I hope. It's true that I never solve more than 3 problems in a contest. Bring good luck to me and all of you, too!
 » 18 months ago, # | ← Rev. 2 →   -49 I think, Arpa means "Artem", not "Artsem".
 » 18 months ago, # |   +86 Still no one answered if the contest is rated officialy? What kind of joke is this? How can CF admins allow this
•  » » 18 months ago, # ^ |   -131 If you really didn't get, Yes, it's rated.
•  » » » 18 months ago, # ^ |   -34 I asked same but I got many down votes :| why ?
•  » » » » 18 months ago, # ^ |   -8 you asked,but in bad place. and also in that place you should mention that it wasn't mentioned in the blog.-some people have algerie to "Is it rated?"-
•  » » » » 18 months ago, # ^ |   0 Because you have done it for a joke.
•  » » » 18 months ago, # ^ |   -22 Please include that in the post. I take CF round very seriously and you are making fun out of it
•  » » » » 18 months ago, # ^ |   +24 how could you say that ! this is your second contest
•  » » » » 18 months ago, # ^ |   +15 but if you are really active , why you still don't know that the round is unrated only when they say it in the announcement
 » 18 months ago, # |   +5 Spoiler Alert!
 » 18 months ago, # | ← Rev. 2 →   -13 In fact,it is rated as usual.So,don't ask the same questions unless you want to get a lot of down votes. :)
•  » » 18 months ago, # ^ |   +1 like you, and like me (because i know this comment will get lots of down votes) :)
 » 18 months ago, # |   +46 I've advanced to the finals, but I'm in other country on bubblecup, so I had no time or posibility to take part in the finals, also I've not visited hackerearth website last days, in one word: I have no idea about competition, I only know who won it (from friend). Can I write this round?
•  » » 18 months ago, # ^ |   +17 Yes, this is fine. We have a list of people who opened the contest, so you should be able to compete as long as you didn't open the problems.
•  » » » 18 months ago, # ^ |   +6 you are pasting your line again and again :D
 » 18 months ago, # |   -21 So are Codeforce rating contest or this unrate codeforec.com contest on internet. Plz I now need now!
 » 18 months ago, # |   +157 Thanks to CF calendar, I don't need to ask whether the round is rated or not. For those who don't know about this:
•  » » 18 months ago, # ^ |   0 I don't even need the calendar to know this fact, this contest's name is "Codeforces Round #432" so since it booked a number (432) it means it's rated, also if it wasn't rated then there wouldn't be two divisions
•  » » » 18 months ago, # ^ |   0 I didn't know that. Thanks for telling us.
 » 18 months ago, # |   +7 What a late time for Chinese players. I'm glad to take part in it ,but out of the curriculum...you know
•  » » 18 months ago, # ^ |   -11 An additional hour later for Korea, Japan and parts of Indonesia...
•  » » 18 months ago, # ^ |   0 I'm a Japanese, and the contest starts at 23:35 and ends at 01:35. Also, system test will ends after 2 o'clock am. It is so late time for 9-th grader student. But this is earlier one I think. Some of past codeforces contests start at 00:05, 00:35, 01:35, ... In the worst case contest starts at 02:35 and ends at 04:35. What time do you think the ending of systemtest and rating update?????????
•  » » » 18 months ago, # ^ | ← Rev. 2 →   0 I am so sorry to hear that,it is an earlier one indeed. But what makes me embarrassed is that I made a mistake.I regarded this contest will start at 23:35,I am so sorry. Wish us would have an interesting contest and have a high rating!
 » 18 months ago, # | ← Rev. 2 →   +24 There will be 5 problems for each division, as usual, you have 2:30 to solve the problems.Is 2:30 a usual time duration for Codeforces contests?
•  » » 18 months ago, # ^ |   0 No, the usual time is 2:00 to solve the problems.
•  » » 18 months ago, # ^ |   -6 I think they mean usual for an IndiaHacks round.
 » 18 months ago, # |   -47 is the contest rated ? :P
•  » » 18 months ago, # ^ |   0 Are you moron?
•  » » 18 months ago, # ^ |   +5 You are already 9th that gives that question
 » 18 months ago, # |   -14 It was 2.5 hours or more surprising when I first saw the game. As a Chinese player, I needed to go to bed after one o'clock in the morning, and I hope that tomorrow morning classes will not fall asleep. In addition, I wish codeforces would be getting better and better, and this competition can be rated normally. I wish you all good results in the competition.
 » 18 months ago, # |   0 WoW,I think it's an excellent contest. Although the contest will start at 22:35 in China. I will take part in it! :P
 » 18 months ago, # |   0 So is it like there are 4 shared problems in both divisions?
•  » » 18 months ago, # ^ |   -34 No. 3.
•  » » » 18 months ago, # ^ | ← Rev. 3 →   0 so right now there is two condition: 1.Div 1 is simpler 2.Div 2 is harder so which one is correct??
•  » » » » 18 months ago, # ^ |   0 In fact, Div 2 is simpler than Div 1.
•  » » » » » 18 months ago, # ^ |   0 I know that,but from the place that 3 question are shared,question c,d,e div 2 is shared,so if C or D are harder than usual ,div 2 is harder,and if not both div are as usual as they were.(actully i'm not sure about what i'm saying:) )
•  » » » » 18 months ago, # ^ |   0 Neither :)
 » 18 months ago, # |   -7 can anyone say's what is the difference of CUP,and contest that based on CUP?
 » 18 months ago, # |   +3 Maybe this article should just tell us if it's rated rather than warn us that question about rated or not will be down-voted.
 » 18 months ago, # |   -14 i dont care it is rated or not. give me down votes
 » 18 months ago, # |   0 Hope to be rated.
•  » » 18 months ago, # ^ |   0 yes, it is as you wish
•  » » 18 months ago, # ^ |   +18 After the contest you will hope it was unrated.(Off topic question: is the previous sentence grammatically correct? If not, how should I say it correctly?)
•  » » » 18 months ago, # ^ |   0 FIX: After the contest you would wish the contest was unratedBut anyway, we are programmers, we code, we encrypt and decrypt. Grammatical mistakes are nothing.
•  » » » » 18 months ago, # ^ |   0 "Grammatical mistakes are nothing."My compiler doesn't think so.
 » 18 months ago, # |   0 Didn't able to register IndiaHacks Final Round 2017 Div 2. On clicking the register button says page not working codeforces.com didn’t send any data. ERR_EMPTY_RESPONSE
•  » » 18 months ago, # ^ |   0 Now working
 » 18 months ago, # |   0 I feel confused why there are many people who want to know if it's rated?
 » 18 months ago, # |   +10 Hope clear problem description this time.
 » 18 months ago, # | ← Rev. 2 →   -23 Love you Arpa
•  » » 18 months ago, # ^ |   0 Hello I am your new competitor.
•  » » » 18 months ago, # ^ |   +3 and how about me ? :DDD
•  » » » » 18 months ago, # ^ |   +6 shit veryyyyyyyyyyyy funny :|
 » 18 months ago, # |   -16 I usually don't understand Indian accents. Will it affect my performance?
•  » » 18 months ago, # ^ |   -10 Dude i understand that you want downvotes, but being racist is just blatantly wrong and i think that your account should be temporarily suspended.
 » 18 months ago, # |   0 Nice joke with rate/unrate...Good luck everyone! :3
 » 18 months ago, # |   +3 Does Minimum Spanning Tree appears in any codeforces Div-2 contest? As of now, I haven't seen any :/
•  » » 18 months ago, # ^ |   +2 Why do you care if it appears or not?
•  » » » 18 months ago, # ^ |   +1 Because he only knows minimum spanning tree hahahah
•  » » » » 18 months ago, # ^ |   0 xD Thats one funny explanation
 » 18 months ago, # |   +12 Arpa you and your teacher have almost the same rating. That's cool :)
 » 18 months ago, # |   +14 Is it rated OR not? Yes!
 » 18 months ago, # |   +9 in today's round ,will div1A==div2C or div1A==div2D ?
 » 18 months ago, # |   +10 Less than 2 minutes until contest, and still no score distribution. Later means, after contest?
 » 18 months ago, # |   +19 3rd contest with geom, I think I will lost my rating(
 » 18 months ago, # |   -43 too weak pretests for problem D div2
•  » » 18 months ago, # ^ |   +21 Is it a thing that you can say during the contest? If your saying is true, many people that knows your comment use the different strategy.
 » 18 months ago, # |   +52 is this mathforces??
 » 18 months ago, # |   0 codeforces is not taking submissions. Is there any issue with portal ?
 » 18 months ago, # |   +62 wtf how much geometry ? 2 problems out of 5 ?? that cruel
 » 18 months ago, # |   +4 Unable to see other's code for hacking :|
 » 18 months ago, # | ← Rev. 4 →   -14 Why Unrated is higher than Rated?
•  » » 18 months ago, # ^ |   +8 I think Arpa and his teacher wanna to make more down rating users like them! I think sum of all users rating changes in contest equal to 0.
•  » » » 18 months ago, # ^ |   0 Congratulations! I got many down votes because of baby who is you ;) Heyyy don't jump at me ;\
•  » » » 18 months ago, # ^ |   0 You were wrong and I won! First fact you got -50 Ha ha ha ha ha ha!
 » 18 months ago, # |   0 In Div2B, i have try to hack three different solution on same test case ,two of them giving "Yes" and one is giving "NO" as output still all goes unsuccessful. and try to hack a code in which he is dividing by 0 but still i got unsuccessful.
•  » » 18 months ago, # ^ |   -11 there is something problem in hacking ...please check
•  » » » 18 months ago, # ^ |   +1 You didn't have three equal hacks by the time of posting, and all outputs were "No".
 » 18 months ago, # |   +5 We need more geometry problems, why two only?
•  » » 18 months ago, # ^ | ← Rev. 2 →   +3 you need more not me. you solved both problems?:)
 » 18 months ago, # |   +80 WTF was this contest? I'll give you all diplomas.
•  » » 18 months ago, # ^ |   -47 Keep calm and just hate Arabs
•  » » 18 months ago, # ^ |   +14 I want Medal :(
 » 18 months ago, # |   +225
•  » » 18 months ago, # ^ |   +22 upvote if you go to the CF to read the memes
 » 18 months ago, # |   0 Someone probably shared problems.
 » 18 months ago, # |   +6 Probably my rating will go up, but I didn't like problems...
•  » » 18 months ago, # ^ |   +4 well the goal of the contest was to make it painful for div2 first : 2 geometry problems second : only 5 problems while div1 has 6 maybe an extra non geomtric problem would make it less frustrating
 » 18 months ago, # |   0
 » 18 months ago, # |   +4 Hardest B-Div2 in the History!
•  » » 18 months ago, # ^ |   -7 Not that hard if you google it!
 » 18 months ago, # |   +5 I don't understand why some people submit obvious wrong bruteforce for d(it's painful to hack them).
•  » » 18 months ago, # ^ |   0 what's the solution?
•  » » 18 months ago, # ^ |   0 I had solution where I generated primes up to 10^6 and done something with them + optimization. Is that bruteforce you are talking about or?
 » 18 months ago, # |   +6 ideas on div2 C ?
•  » » 18 months ago, # ^ |   +5 I think this works.First of all, dismiss the cases n = 1, n = 2 as trivial (I failed to do this correctly on many instances).Now, note that if n > 11,  there cannot be any good points. (verify this with the 2 dimensional case, where a similar conclusion holds when n > 5, and extrapolate). Now n ≤ 11 and it suffices to simply brute force every triplet of points, which works in time.
•  » » » 18 months ago, # ^ | ← Rev. 2 →   0 how did you up come with that observation ?
•  » » » » 18 months ago, # ^ |   0 Intuitively, it gets increasingly difficult for a point to form an obtuse angle with every pair of points as the number of points get very big. My first observation was that there can only be one good point when n ≥ 3,  since if P is a good point, and so Then I realized it's difficult for even one good point to exist, which led me to the bound I found in the previous post (I think I have a proof, but it is quite messy).
•  » » » 18 months ago, # ^ |   0 could you explain in details about n > 11, please?
•  » » » » 18 months ago, # ^ |   +1 It's nothing close to a formal proof, but the proof I have in mind is quite tedious, so I'll just give a heuristic argument.Consider the 2 dimensional case of this problem. The maximum number of points there can be in order for there to be a good point is 5. (consider the zero vector and the unit vectors in each direction (+x,-x,+y,-y)). In the 3 dimensional case, it's also pretty clear that the best we can do is 7,  with the same construction (except we add +z and -z). Extrapolating this way, I got my bound of 11 (although in retrospect I should have been more lenient, just in case).
•  » » » 18 months ago, # ^ |   0 Yup, i failed that n=1 n=2 this time...tried for an hour but that didnt cross my mind...well atleast this wont be happening again!
•  » » » 18 months ago, # ^ |   0 Wow,how did you think of this,I mean,as an amateur I thought that it's hard for a collection of a lot of points to exist such that some points are good among them,but to make SUCH A BOLD statement that, ans = 0 for n > 11..I want to learn how did you think of this,and also how you convinced yourself.. I mean not intuitively but what solid reasoning made you confident on your statement?!Thanks!!
•  » » » » 18 months ago, # ^ | ← Rev. 2 →   +1 I'm an amateur myself, but I think the intuition for this came from doing math contests (which I'm not that much of an amateur in), where I encountered similar problems. Starting with the 2D case was a natural step (I can actually draw the points!), where I noticed that 5 points was maximal. I didn't arbitrarily choose the number 11 and try to prove that it was maximal, but I think the extrapolation method is enough motivation. I did come up with somewhat of a proof before I submitted, but I was fairly certain in my intuition. I generally wouldn't submit without at least a sketch of a proof.
•  » » » » » 18 months ago, # ^ | ← Rev. 2 →   0 pretty impressive,my background in math isn't that solid,for most of it I have studied only calculus and almost no geometry, Your statement was no less than MAGIC to me,seriously, I will try to keep this in mind,also if you can link some article or some proof,please do,I can't find one..By the way,In the end when I was not able to think of a solution for Div2 C, I submitted a brute force solution which was O(n^3),someone told me 10^9 operations run fine on codeforces server,lets test that today :PEDIT: I was unaware of the situation that for n > 11 the solution would be zero,so in order to make my N^3 solution run,I made a little pruning effort by breaking the loop in case acute angle occured,so my algo reduced to O(11^3) for n > 11,pretty lucky haha :D
•  » » » » » » 18 months ago, # ^ |   +19 That's good to hear. I think v_Enhance's post here serves as a nice proof (I forgot about this until now, oops.)
•  » » 18 months ago, # ^ |   0 My code outputted "0" if N >= 100 and was a brute force otherwise. Does this work?
•  » » 18 months ago, # ^ |   +6 3 points form a triangle. At most, only one of those points can be good by definition of a triangle. Make a queue, pop 3 elements, append at most one. Brute force the points remaining (at most 2).
•  » » » 18 months ago, # ^ |   0 i would agree if we talk about 2D/3D. but in 5D i can't even imagine plane, so taking about properties of triangle in 5D sounds a little bit unreasonable
•  » » » » 18 months ago, # ^ |   0 It is reasonable because when 3 5D points are chosen, they form a plane.
•  » » » 18 months ago, # ^ |   0 I think the same, but I implemented a thing like a sieve.
 » 18 months ago, # |   +5 how to solve div2 B ?fu**ing geometry
•  » » 18 months ago, # ^ |   0 Assume a point of rotation exists, call it X. Then clearly XA = XB = XC and so It follows that it is necessary to have AB = BC,  and moreover to have that A, B, C are not collinear. It is easy to see that these conditions are also sufficient, and we're done.
•  » » 18 months ago, # ^ |   0 You can construct a circle from 3 points (sorry for my horrible English)
•  » » 18 months ago, # ^ | ← Rev. 2 →   0 The requirements are that the distance between A & B and B & C is the same and the points makes a right angle. Play with rotating triangles on Desmos.
 » 18 months ago, # |   0 How did you pass the pretests after getting WA #8 on C, those who did?
•  » » 18 months ago, # ^ |   0 I had a silly mistake not taking into account values with only one prime factor(a typo), and that turned my wa8 into pretests passed.
 » 18 months ago, # |   +3 Give me counter example for (ax-bx)*(by-cy)-(cx-bx)*(by-ay) != 0 (preset 6(
•  » » 18 months ago, # ^ |   0 Use long long
•  » » » 18 months ago, # ^ |   0 That was exactly what I did: http://codeforces.com/contest/851/submission/30078835
•  » » » » 18 months ago, # ^ |   0 I see. You only test that points are colinear, but that is not enough. You should also check that segments ab and bc are equal in length.
 » 18 months ago, # | ← Rev. 5 →   +3 What's up with tc 8 div2E? This is what I did, let's calculate the grundy number G for each prime separately.For a prime, if the powers of this prime in the array in the sorted order are P1,P2,P3...Pn.Then, grundy no. for this prime would be P1^(P2-P1)^(P3-P2)..^(Pn-Pn-1). So Arpa wins only if the xor of G for all primes is 0. Can anyone tell why this is wrong?
•  » » 18 months ago, # ^ |   +3 p1 = 1, p2 = 3 should be a losing state
•  » » 18 months ago, # ^ |   +8 your grundy number is wrong, I counted grundy by dp on bitmasks and it passed.
•  » » » 18 months ago, # ^ |   0 Yeah I get it. Thanks
•  » » » 18 months ago, # ^ |   0 What with states for 2?
•  » » » » 18 months ago, # ^ |   +25 I can't prove it, but there is small number of states even for 2. At least I tried on 229 - 1 and some numbers like that and it worked fine with map.
•  » » » » » 18 months ago, # ^ |   +5 fml seriously? I spent more than 1 hour thinking about that but I thought there would be too many states :(
•  » » » » 18 months ago, # ^ |   0 I think that number of states is less than number of compositions of log(1e9) because when we divide by p^k than we subtract k from max{k1,...,ks}. Am I right?
 » 18 months ago, # |   +4 Can div1 C be solved using grundy numbers, where each prime is equivalent to a nim stack? I couldn't figure out how to compute it though since there are too many states.
 » 18 months ago, # |   0 I like geometry problems. Only if i had read B and C today :(
 » 18 months ago, # |   0 Geometry everywhere
 » 18 months ago, # |   0 This submission for Div 2. D was TLE on pretest 10, does anyone see why? Should be O(10**8) #include using namespace std; typedef long long ll; const int LEN = 1000; bool isP[LEN]; int n, a[500001]; ll x, y; vector pri; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); fill_n(isP, LEN, true); isP[0] = isP[1] = false; for (int i = 2; i*i < LEN; ++i) if (isP[i]) for (int j = 2; i*j < LEN; ++j) isP[i*j] = false; for (int i = 0; i < LEN; ++i) if (isP[i]) pri.push_back(i); assert(pri.size() == 168); // cout << pri.size() << '\n'; cin >> n >> x >> y; for (int i = 0; i < n; ++i) cin >> a[i]; ll ans = (1LL<<60); for (int p : pri) { ll z = 0; for (int i = 0; i < n; ++i) { int d = ceil((double)a[i] / p); z += min((p*d - a[i]) * y, x); } ans = min(ans, z); } cout << ans << '\n'; } 
•  » » 18 months ago, # ^ |   0 There are about 8e4 primes below 1e6. So, total number of operations is about 8e4 * 5e5 = 4e10. TLE thus.
•  » » » 18 months ago, # ^ |   0 Oh I see, I only tried primes under 1000
•  » » » » 18 months ago, # ^ |   0 Im happy to see someone had this idea haha. I solved it same way except for one optimization but it didnt help (i thought its good optimization but looks like not really that much)
•  » » 18 months ago, # ^ |   0 same here!! my solution doesn't pass, where m = 1e6.
 » 18 months ago, # |   0 When in the last five minutes you get hacked on Problem B after spending an hour figuring out that you need to use long numbers and when three points are in a straight line it doesn't work :(
•  » » 18 months ago, # ^ |   0 getting hacked is better than failing in the system testing .
 » 18 months ago, # |   0 In problem B, i thought that only when AB = BC you can achieve thing described in problem. I coded but it failed on test 3. Why does it not wok?
•  » » 18 months ago, # ^ |   +2 If the three points are collinear it doesn't work
•  » » » 18 months ago, # ^ |   0 Why it does not work?
•  » » » » 18 months ago, # ^ |   0 If you draw a circle that passes through the three points then you can rotate the page on the center of the circle. You can make that circle for all angles that the points might be in, unless they're collinear
•  » » 18 months ago, # ^ | ← Rev. 2 →   0 The angles of BAC and BCA should be the same as well (but should not be collinear).
•  » » » 18 months ago, # ^ |   0 that'll be true if AB=AC
•  » » 18 months ago, # ^ |   0 You should check if the 3 points are on a straight line.If that is the case ans will be no even if AB=AC.
 » 18 months ago, # |   +13 Problem F in Div. 1 reminded me of this problem from Stanford Math Tournament a few years ago (scroll down to page 7).Can a similar solution be used here?
•  » » 18 months ago, # ^ |   +88 Yes, it can be solved this way, but instead of just finding f(1), one needs to add f(ai) for all i.I still wonder how people solve this problem in 30 minutes, though :) It took me more than 90 minutes yesterday.
•  » » » 18 months ago, # ^ |   +42 It's well-known in China. WJMZBMR created exactly the same problem back in 2012.
•  » » » » 18 months ago, # ^ |   0 Meh, out of 13 people that have solved it, 11 are Chinese, so it seems you are right. That makes me even more sad that I made an error in my calculations which stopped me from getting AC on this.
•  » » » 18 months ago, # ^ |   0 Are the results published anywhere online?
 » 18 months ago, # |   +3 The first contest in wich i solved D and not C. I didn't study n-D vectors in highschool lol
 » 18 months ago, # |   0 what was pretest 10 of DIV1C I calculated grundy number of each prime separately using DP.
 » 18 months ago, # |   +36 Cf rules are stupid, it wasn't "enter the dragon" as I expected. XD
 » 18 months ago, # |   +8 Tfw you find D and E easier than B and C. :/
 » 18 months ago, # |   +125 :(
•  » » 18 months ago, # ^ |   +22 I like geometry and math problems much more than data structures ;d
•  » » » 18 months ago, # ^ |   +17 The Best I Could Make Before my rating drops to Newwwwbie
 » 18 months ago, # |   +3 double ax,ay,bx,by,cx,cy; scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&cx,&cy); double dist1=sqrt((bx-ax)*(bx-ax)+(by-ay)*(by-ay)); double dist2=sqrt((cx-bx)*(cx-bx)+(cy-by)*(cy-by)); double dist3=sqrt((cx-ax)*(cx-ax)+(cy-ay)*(cy-ay)); //pritnf("%lf %lf %lf\n",dist1,dist2,dist3); if(dist1==dist2 && dist1+dist2!=dist3) printf("Yes\n"); else printf("No\n"); What is wrong in this code ? Please help ...
•  » » 18 months ago, # ^ |   0 dist1+dist2!=dist3 What is that? Why?
•  » » » 18 months ago, # ^ |   0 To check if they're not collinear
•  » » 18 months ago, # ^ |   +4 Might be double inaccuracy (e.g. abs(dist1 — dist2) = 1e-8 or some other very small number when they should equal). I kept it as long long (didn't sqrt) and compared the square of the distance so I could compare integers
•  » » 18 months ago, # ^ |   +1 dist1+dist2!=dist3 does not guarantee that the 3 points are not collinear
•  » » » 18 months ago, # ^ |   0 How ? Tell me any example .
•  » » » » 18 months ago, # ^ |   0 for your code: (0, 0) (1000, 1000), (1, 1) in this order. they are collinear, but your code states otherwise
•  » » » » » 18 months ago, # ^ |   +6 this case is taken care by the condition "dist1==dist2" if they are different then for sure the answer is NO but is they are same then only one condition can make the answer NO i.e when points are collinear and if dist1 is equal to dist 2 then the points are collinear only if dist1+dist2==dist3!!!
•  » » » » » » 18 months ago, # ^ |   +2 Floating point error due to the sqrt() function is the reason it fails
•  » » » 18 months ago, # ^ |   0 Man, I tried hacking a solution that did it, but I was wrong ;_;Thing is...we have already checked if d1==d2 or not, if their sum is equal to d3 then they are co linear. So...you can just check if B is the midpoint of AC or not
•  » » 18 months ago, # ^ |   0 Now I know mistake. Order of points may not be A-B-C. Maybe A,B,C are on the line but their order is C-A-B or something so dist1+ dist2 != dist3 but they are collinear.
•  » » 18 months ago, # ^ |   0 There's nothing wrong in this code.I have done the exact same thing and my solution passed system tests :)
•  » » 18 months ago, # ^ |   +5 I used long double instead of double for the distances and used sqrtl() instead of sqrt(), it got AC (after the contest).
•  » » » 18 months ago, # ^ |   0 good for you
 » 18 months ago, # |   +6 How to solve Div2 B ??? I am Helpless in geometry ???
•  » » 18 months ago, # ^ |   0 just check that if point B lies on the perpendicular bisector of line AC. and also these three points must not be collinear. if(B lies on perpendicular bisector of line AC than) print yes else no
•  » » » 18 months ago, # ^ |   +8 Seeing all this I really beleive that becoming purple is really a far dream . :(
•  » » » 18 months ago, # ^ |   +9 same as saying check if the triangle is isosceles!
 » 18 months ago, # |   0 For problem D, I had this approach (time limit on pretest 10). Generate primes up to 10^6. Idea is to find for every prime (not really EVERY, there is optimization) what is minimum that we can achieve to get all numbers divisible by that prime.It is easy to see that we will either delete some number or increase it prime — ( number%prime) times, so there is simple calculation for every number. Now comes optimization: If number of a[i] that are divisible by some prime > 2 is less than or equal to number of a[i] divisible by 2, skip that prime (because it will obviously make worse or same score as with 2). So, after we visit every prime, we will now best answer. I know this is overkill but I thought it would maybe pass because this optimization eliminates a lot of primes (or does it).
 » 18 months ago, # |   +6
 » 18 months ago, # | ← Rev. 2 →   +9 WHY problem C div2 solve with N^3 :(( :((
•  » » 18 months ago, # ^ |   0 It cannot be solved by pure N^3, only with the fact that if the pair giving acute angle is already found, break the loop, which significantly reduces runtime.
•  » » » 18 months ago, # ^ |   0 I know this trick, I use it in D but I dont have reason use it in C... Why n > 100 -> write 0 :(( :((
 » 18 months ago, # | ← Rev. 2 →   +14 First of all, my bad for having a wrong idea and not looking at test samples carefully but I think these kind of things shouldn't happen during the contest....
•  » » 18 months ago, # ^ |   +7 but they did not mention about the point C!
•  » » » 18 months ago, # ^ | ← Rev. 2 →   0 Hey no! Or else everyone's B will fail!
•  » » 18 months ago, # ^ |   +1 I'm really sorry. Excuse me. I remember that I was to press "No"... I don't know what happened, it seems I accidentally pressed "Yes" (in the drop down menu). Anyway, I'm happy that you get the correct answer only after 3 minutes. Sorry again.
•  » » » 18 months ago, # ^ |   0 If it only happened to me, it's fine. Thank you for an interesting problem set. :)
•  » » » » 18 months ago, # ^ |   -9 Yes, only to you. Thanks for your kindness, and sorry again :)
•  » » 18 months ago, # ^ |   0 First Answer was right.... :)
 » 18 months ago, # |   0 So many people have solved div2 D , but I got TLE. What is the algorithm
•  » » 18 months ago, # ^ | ← Rev. 3 →   0 You can enumerate the final gcd, and devide [1,1e6] to several parts like [1,gcd],[gcd+1,2*gcd],[2*gcd+1,3*gcd],and for every part the last x/y values should perform operation 2 for several times , and the rest should perform operation 1.And you can put the array in some bullets, and calculate the suffix sum of the bucket , and another special type of suffix sum which can be calculate like this: s[i]=s[i-1]+bucket[i]*i. And for every part you can calculate the ans under 'this gcd' in O(1) time,and for emutating gcd in and the parts in O(n/1+n/2+....+n/n)=O(nlogn) to solve the problem.Sorry for my poor English.P.S.: You can check the code by miaom 30061008
•  » » » 18 months ago, # ^ |   0 thx. 432 people passed pretest, and now 81 left. miaom code let me realize my algorithm is wrong(TLE) (:з」∠)
•  » » » 18 months ago, # ^ |   0 Wait — you need to check all possibilities for final gcd or what?
•  » » » » 18 months ago, # ^ |   0 Yes, you should check from 1 to the maximum number of the array.
 » 18 months ago, # |   +32 I think the point decrease speed was not adjusted for a 2:30 long contest.
•  » » 18 months ago, # ^ |   +27 NOT ADJUSTED DRAIN NEEDS TO STOP !!!!!
 » 18 months ago, # | ← Rev. 2 →   +15 How to solve C? Don't tell me that the intended way to calculate the Grundy number is DP on bitmask...PS: Btw, RIP yellow color T_T
•  » » 18 months ago, # ^ |   0 I think the answer is "Yes". The number of states is pretty small.
•  » » » 18 months ago, # ^ |   +3 How I can understand it, if maximum degree is 30 as log2(1e9)?
•  » » » » 18 months ago, # ^ | ← Rev. 2 →   +18 I also didn't solve the problem because of this, but now I think I understand why it works. Let's look at states by their maximum set bit. For states where this bit  ≤ 20, we obviously have  < 220 states that we can reach.Now for bits  > 20, for example 23, the number of states is bounded by the number of ways we can reach 23 from 30 by performing subtractions each step, which is basically  < 27.In simpler words the number of states with the maximum bit k is  < min(2k, 230 - k).
•  » » » » » 18 months ago, # ^ |   0 I don't really get your idea there. Could you elaborate it more specifically?
•  » » » » » » 18 months ago, # ^ |   +8 Yeah, let me try explain it in a better way. The problem is when p = 2 (p is the prime factor).Basically we'll have at most 1 state where the maximum nonzero bit is 30, at most 2 states where it's 29, at most 4 states where it's 28, etc. Thus we need to look at how many states that initial state spawns.
•  » » » » » » » 18 months ago, # ^ |   0 I think I get your idea. So, the maximum number of state is not 230, but 215, right?
•  » » » » » » » » 18 months ago, # ^ |   0 Yes.
•  » » » » » » » » » 18 months ago, # ^ |   0 So it turned out that the solution actually involve an elegant observation, not just a "brute force and pray that it'll pass" problem.Thanks for your explanation!
•  » » 18 months ago, # ^ |   0 I think it is. For numbers bigger then 2 is easy but I can't show that for 2 number of states is small.
•  » » 18 months ago, # ^ |   0 If we calculate only DP values that we really need, there could be much less values to calculate. But I can't even make an upper estimate for the count for these values...
•  » » 18 months ago, # ^ |   0 If by "DP on bitmask" you mean "backtrack with memoization" then yes, I believe it's intended.
 » 18 months ago, # |   0 Wrong answer on test 3 (Div 2. C). What's test 3 ??? Why wrong ?
•  » » 18 months ago, # ^ |   +1 did you check the trivial cases n = 1 and n = 2?
 » 18 months ago, # |   +9 I see a lot of submission for Div 2 C checking all i,j,k. And there I was thinking of some fancy algorithm to cut down the runtime :((
•  » » 18 months ago, # ^ |   +4 Not fancy algorithm, but you could use pigeon hole principle to return 0 immediately if n >= 244, and then brute force from there... Think that might be intended solution
•  » » » 18 months ago, # ^ | ← Rev. 2 →   +5 Why 244? Is it actually possible to have 243 vectors from a single point whose respective angles are all not acute? I really hope notEDIT: Okay, I outputted 0 for N >= 100 and passed.
•  » » » » 18 months ago, # ^ |   0 Similar to editorial answer, but I instead considered components of each vector and whether they were positive, negative, or zero (three possibilities). 35 = 243
•  » » » 18 months ago, # ^ |   0 Where do you get 244 from?
•  » » » » 18 months ago, # ^ |   0 32 is optimal, never mindhttp://codeforces.com/blog/entry/54265?#comment-384074
•  » » » 18 months ago, # ^ | ← Rev. 2 →   0 Are you sure about 244? I can't imagine the example with answer >= 0 for more, than 32 points. Can't imagine it too.
•  » » » » 18 months ago, # ^ |   0 32 is optimal, never mindhttp://codeforces.com/blog/entry/54265?#comment-384074
•  » » » 18 months ago, # ^ |   0 Where did you get 244 from ?
•  » » » » 18 months ago, # ^ |   0 32 is optimal, never mindhttp://codeforces.com/blog/entry/54265?#comment-384074
•  » » 18 months ago, # ^ | ← Rev. 2 →   +2 That's what I thought as well. After thinking for half an hour I came up with this: Consider three points. Draw lines between the three points and then you see that only one of them can be good. From there we can deduce there is at most 1 good point. You can now compare the first three points to find one that might be the good point. If the triangle created by the first three points is acute, then just choose one of them to be your candidate even though you know it is not actually a good point. Then do the same thing with your current candidate and some other two points you want to test. After less than n tests you will have a single point that may or may not be good. From there, just use an N^2 algorithm to see if it is actually good or not. I'm not sure if this works yet since system testing is not over but I'm just putting my thought out there.EDIT: it just passed system tests
•  » » » 18 months ago, # ^ |   0 Oh that's a nice little optimization.
 » 18 months ago, # |   +11 GeoForces!!!
 » 18 months ago, # |   +3 Geometry Geometry everywhere :||||||||||||||
 » 18 months ago, # | ← Rev. 2 →   0 For Div2B : the two cases that can produce a "yes" are:1- the triangle has 3 equal sides.2- the triangle has a right angle centered in point b and distance(a,b) = distance(b,c).what am i missing here ?
•  » » 18 months ago, # ^ |   0 any isosceles triangle with ab=bc will do the job
•  » » » 18 months ago, # ^ |   0 No. The triangle must have a positive area and have a right angle at point b
•  » » » » 18 months ago, # ^ |   +1 No. Right angle does nothing. Center of rotation will be circumcenter of triangle ABC and only thing you need is AB = BC and A,B,C are not collinear. I dont know why you think right angle is important.
•  » » » » » 18 months ago, # ^ |   0 Yup, for me I checked that:1- slope(AB) != slope(BC) AKA They are not collinear2- |AB| = |AC| If both above conditions are satisfied the answer is Yes. The gotcha for me was when computing the slope when ax == bx or bx == cx (since I ended up with a division by zero). So I added an extra condition to check for this. in the beginning
•  » » » » » » 18 months ago, # ^ | ← Rev. 2 →   0 you can check the slope by multiplication:(x1-x2)*(y1-y3)==(y1-y2)*(x1-x3)There will be no zero division
•  » » » » » » » 18 months ago, # ^ |   0 Awesome! Thanks
 » 18 months ago, # |   0 anyone know how to solve 1B in a non-hacky way? I am no good at math
•  » » 18 months ago, # ^ |   +1 You can see my submission, it runs in O(10^6log(10^6)).
•  » » » 18 months ago, # ^ |   0 Can you please explain what's happening? I'm still confused.
•  » » » » 18 months ago, # ^ | ← Rev. 3 →   +9 My submission just got wa on 61. :(I think it should be some edge case I missed (EDIT: yep, a very stupid one). What I did is fix some final gcd. Every number has to be a multiple of this gcd. We have two options, either delete the number or make it a multiple of this gcd. First find which of the options is suitable. Let's say you increment some number k times to make it a multiple of the gcd, then for it to be optimal, k*y must less than or equal to x i.e k <= floor(y/x) otherwise we could just delete the number instead of increasing it. Now fix two consecutive multiples of this gcd, call them z1 and z2 and z1 < z2. You need to change the numbers between them. So increase the numbers which are in the range [z2-k, z2] and delete the remaining ones i.e [z1, z2-k-1]. To efficiently calculate this, use some prefix sums.Let me know if something is still unclear.
 » 18 months ago, # | ← Rev. 2 →   +9 I thought I saw RoadToMaster's coding style and templates of problem D and E div.2 are different. Am I wrong ?P/s. He/She is now at rank 8.
 » 18 months ago, # | ← Rev. 2 →   0 Ignore
•  » » 18 months ago, # ^ | ← Rev. 2 →   +3 In both cases, the answer is to delete all, isn't it?
•  » » 18 months ago, # ^ |   0 What's the bug causes wrong answers here?
•  » » » 18 months ago, # ^ |   0 I think not considering x*n
 » 18 months ago, # | ← Rev. 2 →   +12 Why the hell would anyone put 100+ test cases on div2A? It's just gonna take a really long time to test, and I doubt it will be more efficient than having like 30
 » 18 months ago, # |   0 I have a feeling that system test is going to destroy many people (including me) :v
 » 18 months ago, # |   +24 many O(n3)s passed on div1A. Why not make n ≤ 3000?
•  » » 18 months ago, # ^ |   +5 Because answer is 0 for n > 64 and one will eventually end up with 64n2 operations?
•  » » » 18 months ago, # ^ |   +18 ? if(n>64) { cout<<0<
•  » » » » 18 months ago, # ^ |   +4 But input would TLE on their side with 1e18 =)
•  » » » » 18 months ago, # ^ |   0 Could you elaborate your proof for n > 64?
•  » » » 18 months ago, # ^ | ← Rev. 3 →   +1 n > 64 is very high upper bound. Answer will be zero if n > 11. AC solution http://codeforces.com/contest/850/submission/30076671I can give you an intuitive proof. First of all for n >= 3, answer could not be greater than 1, thus we only need to find this point. So lets think about the upper bound in 2D, then we will extend our solution to 5D. Without loss of generality, assume the point which we want to find to be the origin. You could only place 4 points(two on each axis, one on positive side and other on negative side of the axis) such that point at origin is a good point. Now think about 3D. In going from 2D to 3D we can only place 2 more points(on the 3rd axis) such that origin is a good point. Hence in 5D, there can be atmost 10 points excluding the origin. Thus for n > 11 answer will be 0.My solution's complexity was O(n + 113), which is a pure brute-force solution after considering the above observation.
 » 18 months ago, # | ← Rev. 2 →   0 Div.2 C: is acute (i.e. strictly less than 90°) but it was not said that acute is strictly more than 0 degrees.
•  » » 18 months ago, # ^ |   0 Let's continue your thought.What if  - 1,  - 2,  - 3, ... are also acute? What would it mean to be obtuse?
 » 18 months ago, # | ← Rev. 2 →   0 In div2D, isnt this conditions enough?If initially gcd > 1, then answer = 0 Else ans = min(cost(2) , min(cost(x)) for all x, where x is an odd number present in an array, and cost(x) is the cost to make gcd equal to x.PS — got it, its wrong.
•  » » 18 months ago, # ^ |   0 Consider such circumstance that you have an array teemed with odd numbers along with a single 1, where you will proceed cost(x) for N times.
•  » » 18 months ago, # ^ |   0 No.Let's say you have 9 14 15 21 the best answer would be cost(3).
•  » » » 18 months ago, # ^ |   0 Got it thanks!
•  » » 18 months ago, # ^ |   0 3 1000000 1 9 9 2'odd number present in an array' and 'GCD = x' may not satisfy at the same time
•  » » 18 months ago, # ^ |   0 Okay, how about this case: 2 9 21 let modification cost to be A, removal cost to be exorbitant then cost(2) = 2a, cost(9) = 7a+6a, cost(21) = 19a+12a however,cost(3) = aIn this case the condition you have proposed seems to be insufficient.
•  » » 18 months ago, # ^ |   0 The fact is it depend on prime make it :) :)
 » 18 months ago, # |   +4 In problem A shouldn't an acute angle be strictly greater than 0°? https://en.wikipedia.org/wiki/Angle
 » 18 months ago, # |   +5 When it takes you 5mins to read,solve & submit problem D(got WA but still impressed) :D
•  » » 18 months ago, # ^ |   +2 A similar problem was once on a Quera contest and here the pretests were too weak so you just had to copy your code from the other problem.
 » 18 months ago, # |   0 F seems cool. I have a pretty unproven guess at the solution. Maybe somebody could verify?Let E(something) be the expected time taken for something to happen, and | inside meaning conditionality.Let's ignore mod P, because we can.ans = sum over colours of P(colour i dominates eventually) * E(1 colour let| colour i dominates).So all we need is to evaluate E(1 colour let| colour i dominates). Clearly easy. coughAll we need to care about is how many balls of i there are at a given moment. Define F(k) to be E(dominates starting from k balls of colour i | colour i eventually dominates).We handwave and pretend that we can treat it as if transitions happen every step, but scale the duration of the step accordingly. (You are feeling extreeeemely sleeeepy...)Then since we know that for an unbiased random walk starting from 0, the probability of hitting -a before b is a/(a+b), the transitions must be (conditionally) weighted in ratio k+1:k-1.Now we form a linear equation for F(k): F(k) = T + (k-1)/2k * F(k-1) + (k+1)/2k * F(k+1), where T, the expected time is (kC2 + (n-k)C2)/nC2.Solving this takes O(N^2) time and we are done.Anyone knows if this is correct and if so, is there any way to justify the handwaving step?
•  » » 18 months ago, # ^ |   0 "Then since we know that for an unbiased random walk starting from 0, the probability of hitting -a before b is a/(a+b)" — but here our random walk is not unbiased. I also don't get "the transitions must be (conditionally) weighted in ratio k+1:k-1."Moreover I don't think that "handwaving step" is correct, I do not know how to exchange between problems with transition every step and not in every step, because avergae waiting time is different for different number of balls in our color.Moreover I don't know where did you get O(n^2). However I believe that we can reach conclusion using your logic. We just need to work out a lot of formulas and hope that we will get something that will be possible to evaluate in time.
•  » » » 18 months ago, # ^ | ← Rev. 2 →   0 Thanks for the reply.The random walk is unbiased -- the probability of converting colour A to notA is the same as converting colour notA to A. (since the probabilities of exchanging orders of draw is the same).For the weightage of the ratios, we have:P(transition to k-1 balls | a transition happens and colour i eventually dominates) = P(k-1 balls eventually dominate)/2 / P(k-1 balls eventually dominate)/2 + P(k+1 balls eventually dominate)/2, where /2 is the probability of the transitions happening.The linear equations are of form aF(i-1)+bF(i)+cF(i+1) = d. So the matrix looks like:XXOOO|? XXXOO|? OXXXO|? OOXXX|? OOOXX|?whereby gaussian elimination actually can take O(N) time.Handwaving is handwaving. I can't defend that.
 » 18 months ago, # |   +69
 » 18 months ago, # |   0 LOL. Many O(N^3) solutions passed Div2 C. And all of them using C++. Why not decrease input to pass time limit not only using C++ ?
•  » » 18 months ago, # ^ |   +6 They are not actually N^3. If N is large, it takes very little time to ensure that points are bad.
•  » » 18 months ago, # ^ | ← Rev. 2 →   0 Can you share some link to solution O(N^3) please.Edit: I found one.
 » 18 months ago, # |   +32 Tests of Div1 B are too week. This accepted submission fails with this test.499999 1000000000 1 1 3 5 7 9 11 13 15 17 19 .... 999991 999993 999995 999997 (all odd numbers except 999999)The answer is 499999, to make all numbers even. But this program outputs 500000.30079608
•  » » 18 months ago, # ^ |   0
 » 18 months ago, # |   0 I have seen many solutions of DIV2C. Many solutions which have O(n^3) time complexity passed system test. How is it possible with n=1000 and time limit of 2 secs? According to me, 1s has almost 10^7 iterations. Someone explain this to me or Correct me if i am wrong!
•  » » 18 months ago, # ^ |   +5 Codeforces judge servers are quite fast. It can run a simple loop of 10^9 iterations within 2 seconds.
•  » » » 18 months ago, # ^ |   0 are you sure?
•  » » » » 18 months ago, # ^ |   +1 If you can't believe that, try some custom invocations.
•  » » » » » 18 months ago, # ^ |   0 i didn't solve it. Thought O(n^3) will give TLE. How to judge the time limit? There should be any principle.
•  » » » » » » 18 months ago, # ^ | ← Rev. 2 →   0 Don't you know what the custom invocation is?
•  » » » » » » » 18 months ago, # ^ |   0 i know:). I just told u how cheated i m feeling right now
•  » » 18 months ago, # ^ |   0 Apparently codeforces uses fast computers, which can process over 1 billion simple operations in 1 second, especially in C++. Not sure if pruning helps squeeze the time limit.
•  » » 18 months ago, # ^ | ← Rev. 2 →   +7 If you have a break in the right place, the complexity is something like n^2*2^5, even though it looks like n^3 at first glance.
•  » » » 18 months ago, # ^ |   0 i didn't solve it. Thought O(n^3) will give TLE. How to judge the time limit? There should be any principle.
•  » » » » 18 months ago, # ^ |   0 It's very approximate. Custom invocation helps. In this particular problem, O(n^3) probably does actually TLE. If you break when you find an acute angle, the complexity is less than O(n^3), because for large n there are many acute angles (see the editorial for details when it gets posted).
•  » » » 18 months ago, # ^ | ← Rev. 2 →