Return Match
Time limit2sMemory limit1024 MB
Given the first leg score and the live second leg score, decide whether the tie can end level on total goals and away goals.
- Level
Easy2 of 10
- Topics
- Brute force, Implementation
- Solved
- No attempts yet
Problem
Two popular football teams, A and Б, want to find out which of them is stronger. They play a two-match tie. The first match is played at A's stadium, and the second is played at Б's stadium.
The winner of the tie is the team that scores more goals in total. If the total is equal, the team that scored more away goals (goals scored at the opponent's stadium) wins. If the away goals are also equal, the teams play a penalty shootout.
During the second match, the radio show "Listen Carefully" was broadcast with commentator Vasya. Listeners kept asking about the current score on the scoreboard, and also about whether the match could end in a way that sends the tie to a penalty shootout.
Vasya is not good at math, so he asks you to write a program. Given the result of the first match and the current score of the second match, the program determines whether the listeners can see a penalty shootout.
Input
The first line contains the result of the first match A:Б (played at A's stadium) in the format a:b, where a is the number of goals scored by the home team and b is the number of goals scored by the guests. Here 0 <= a, b < 10.
The second line contains the current score on the scoreboard of the second match in the format Б:A. Both numbers follow the same rules.
Output
Print YES if the match can end with a score that sends the tie to a penalty shootout. Otherwise, print NO.