vacuous's blog

By vacuous, history, 9 years ago, In English

Hi I have been trying this question by another method. http://codeforces.me/contest/552/problem/D

In this question, there are points in a 200X200 area and the total number of triangles(with non-zero areas) are to be calculated. Number of points is < 2000.

So instead of taking advantage of the 200X200 area, I was trying to take advantage of n<2000.

Logic -> All sets of 3 points form a triangle except when they are collinear. For lines to be collinear their slope and y-intercept needs to be same.

y=m*x + c

Since n<=2000, we can calculated m & c for every pair, store them, sort them and then compare.

I am getting WA for this logic. The test case is big and hence not entirely visible. I tried debugging the code but unable to find the bug.

One probable cause of WA , what I think , maybe the loss of precision. I am storing the slope in a double variable and comparing it afterwards. It maybe any rational number and it is rounded off differently in different cases. And while comparing they may be treated as different. Not sure, but this may be the source of the WA.

I have tried my best to keep the code simple to understand and have commented in between as well.

ideone link -> http://ideone.com/FoQyfl

http://codeforces.me/contest/552/submission/11714049

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By vacuous, 10 years ago, In English

Following is my code from Codeforces Round #275 for the Question Interesting Arrays(http://codeforces.me/contest/482/problem/B)

It passed all pretest but during system testing, it gave a runtime error on pretest 28. The input was big and so it is not completely visible in the checker log. I tried to debug and tried many random testcases but I am unable to figure out the cause of runtime error.

If anyone is able to figure out the reason please tell me. Or even a testcase on which runtime error is given would do much help. Thanks.

http://codeforces.me/contest/482/submission/8392887

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By vacuous, 10 years ago, In English

My recent contest got completely screwed up. I am wondering by how much would my rating fall. A question pops up in my mind.

What is the largest fall in codeforces rating(in a single contest) that someone may have experienced. I tried to google it but no help. If you have experienced , or know someone who has experienced a great rating fall, please comment.

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it