This was my first programming contest. It started at 1AM my time,
so I was a bit tired, but it was fun nonetheless.
Here are 3 that I got WA on and my algorithm. If someone finds
a hole in my algorithm or has some tricky input, let me know.
World Cup Noise (Problem G):
This looks like a simple fibonacci problem. out[1] = 2, out[2] = 3, out[3] = 5, out[4] = 8. However, I tried this and got WA. What tricky input am i missing (statement says only positive integer input)?
The Marriage Interview (Problem C)
Here are the outputs my program generates. What tricky input am I missing, or which of these are wrong.
Input:
Output:-1 3 0 3 1 3 2 3 3 3 4 3 5 3
0 1 1 1 2 1 3 1 4 1
0 0 1 0 2 0
61 61
Case 1: 1
Case 2: 1
Case 3: 1
Case 4: 4
Case 5: 7
Case 6: 13
Case 7: 25
Case 8: 1
Case 9: 1
Case 10: 2
Case 11: 3
Case 12: 4
Case 13: 1
Case 14: 1
Case 15: 1
Make Polygon (B)
Root of problem was to figure out whether angles were interior angles or exterior angles (where you have to do angle = 360 - angle).
I used the sum of (xy[i+1]-x[i+1]y) to determine whether the polygon was clockwise or counterclockwise. I then used this along with the sign of the cross product to see whether I had an interior angle or exterior angle. I tried some pretty simple inputs:
3
0 0 10 0 5 10
3
0 0 5 10 10 0
5
0 0 5 5 10 0 10 10 0 10
5
0 0 0 10 10 10 10 0 5 5
Were there other tricks (self intersecting polygons, etc.)? Are my equations above totally hosed for non-convex polygons?