Mock CCC '22 Contest 2 J2 - Snowboarding Championship

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Problem type

Andrew has somehow made it to the alpine snowboarding finals! He is up against his long-time rival Tommy.

Each snowboarder will be going down their own hill, with N obstacles. The i^\text{th} obstacle in Andrew's hill has height X_i, and the i^\text{th} obstacle in Tommy's hill has height Y_i. Andrew can jump A meters high, meaning he can clear all obstacles strictly less than A meters, while Tommy can jump B meters high. The snowboarders can jump over the obstacles in 1 second while going around them takes 2 seconds. If a snowboarder cannot jump over that obstacle, they will go around it.

Given the heights of the obstacles in each hill, and the snowboarders' jumping height, determine who wins the race. The winner is the snowboarder who finishes the course in less time.


0 \le N, A, B, X_i, Y_i \le 10^5

Input Specification

The first line contains three space-separated integers: N, the number of obstacles on each course, A, Andrew's jump height, and B, Tommy's jump height.

The next N lines contain two space-separated integers X_i and Y_i, the height of the i^\text{th} obstacle in Andrew's hill and Tommy's hill, respectively.

Output Specification

Output Andrew wins! if Andrew wins, Tommy wins! if Tommy wins, and Tie! otherwise.

Sample Input

5 4 3
1 2
4 5
6 2
4 4
1 7

Sample Output



Andrew completes the course in 1+2+2+2+1=8 seconds, and Tommy completes the course in 1+2+1+2+2=8 seconds as well.


  • 4
    HaDerrick  commented on Feb. 20, 2022, 11:04 a.m.

    I will never be happy about the fact that it took me like 10 minutes because I thought the higher time wins.