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 .
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 151 |
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 .
Name |
---|
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....
His concept is right! Just read the question again!
Can i get any ideas where i am going wrong . Thank you
Just cross check your formula for finding the area of the polygon
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