ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1378. Artificial Intelligence

Why I can't pass the 7'th test?
Posted by Pavel 12 Apr 2008 18:57
Hello. My solution gets WA on then 7'th test. I can't realize, why it does.

my algorithm:

  find the described rectangle (x1,y1,x2,y2)
  if abs((x2-x1)-(y2-y1))>3 then it is triangle;exit;
  if abs((x2-x1)-(y2-y1))=0 then check if is rectangle; if it's so, then exit;

  here I have a figure (triangle or circle) that is described with "nearly" square. I allow that the circle can be described not with a square (because of roundings). I calculate the area of the figure. Then:

  if area>5/8*sqr(((x2-x1+1)+(y2-y1+1))/2) then
    it is circle
  else
    it is triangle

the final decision is based on this:
  For example, triangle in described with a square with side = A. Then it's area ranges from 0 (not including) to sqr(A)/2 (including). The circle with diameter=A have area that is nearly equal to PI/4*sqr(A). The number 5/8 lies between 1/2 and PI/4.

why does my solution not get AC?

Edited by author 12.04.2008 21:08