Блог пользователя vishva1994

Автор vishva1994, история, 9 лет назад, По-английски

Question : http://www.codechef.com/problems/CHPLGNS
My Solution : http://www.codechef.com/viewsolution/7305267

Where am i going wrong ? Why WA . I am finding area and then counting . Help required .

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

area concept is not right....suppose u have a bigger square and a smaller square outside the bigger square.... then ur solution gives that smaller square is inside the bigger square....which is wrong....

»
9 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

I think, you don't even need to calculate the area of the polygon

My Idea, for every polygon find out the max(x's), min(x's), max(y's), min(y's) . This will look like rectangle. Thus sorting on any one axis(x's or y's) you can find the result. or you can calculate the area of rectangle and sort and get the result.

I can see that there is an editorial to this problem. Why not read that ? BTW, the second idea of editorial is similar to mine