ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

USU Personal Contest 2003

About     Problems     Submit solution     Judge status     Standings
Contest is over

E. Tethered Dog

Time limit: 1.0 second
Memory limit: 64 MB
A dog is tethered to a pole with a rope. The pole is located inside a fenced polygon (not necessarily convex) with nonzero area. The fence has no self-crosses. The Olympian runs along the fence bypassing the vertices of the polygon in a certain order which is not broken during the jog. A dog pursues him inside the fenced territory and barks. Your program is to determine how (clockwise or counter-clockwise) the rope will wind after several rounds of the Olympian's jog.


The first input line contains a number N that is the number of the polygon vertices. It’s known that 3 ≤ N ≤ 200000. The next N lines consist of the vertices plane coordinates, given in an order of Olympian’s dog. The coordinates are a pair of integers separated with a space. The absolute value of each coordinate doesn’t exceed 50000.


You are to output "cw", if the rope is winded in a clockwise order and "ccw" otherwise.


0 0
0 1
1 1
1 0
Problem Author: Evgeny Kobzev
Problem Source: Ural State University Personal Programming Contest, March 1, 2003
To submit the solution for this problem go to the Problem set: 1246. Tethered Dog