RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00027

Tenis

Silver II 실버 II
난이도
0.600s
시간 제한
32MB
메모리 제한
1
맞았습니다!!
1
제출 수
100.0%
정답률
레이팅

의견: 0

설명

After Borko's second plan of taking over the village fell through (because Mirko's brother Stanko drank all the water), young Zvonko decided to relax with sports. For this purpose he stocked up on carrot juice and peanuts, and dived onto the couch, ready to watch the next tennis match on television.

While the two players are warming up, their statistics pop up on the screen. Zvonko noticed that the match history of the players contained invalid results. He had a brilliant idea where you write him a program that checks the validity of results, which he will then sell to the record keepers and enjoy a leisurely life.

A tennis match consists of sets, each set consisting of games. The following rules apply:

  • A player wins a set if he has \(6\) or more games and at least two games more than his opponent.
  • Additionally, if the result is \(6{:}6\) in the first or second set (but not the third set), a single final game is played to determine the winner of the set (the tie-break game).
  • The match ends when either player has won \(2\) sets. That player is the winner.

A match result is valid if a match could have been played by the above rules and ended in the result.

Additionally, if one of the players is Roger Federer (designated as federer in the input), then a result in which he has lost a set can't be valid (Zvonko knows Federer is from outer space).

Write a program that checks the validity of all matches between two players.

제약
입력 형식

The first line of input contains the names of the two players separated by a single space. Both names will be strings of at most 20 lowercase letters of the English alphabet. The names will be different.

The second line contains an integer \(N\) (\(1 \le N \le 50\)), how many matches the two players have played.

Each of the following \(N\) lines contains the result of a single match, composed of the results of a number of sets separated by single spaces. Each match result contains between \(2\) and \(3\) sets.

A set is given in the format \(A{:}B\), where \(A\) and \(B\) are games won by each player. These numbers will be integers between \(0\) and \(99\) (inclusive).

출력 형식

For each match, in the order they're given in the input, output da if the result is valid, or ne if it isn't.

서브태스크
서브태스크점수설명

Subtask 1

40점
예제 1
입력
sampras agassi
6
6:2 6:4
3:6 7:5 2:6
6:5 7:4
7:6 7:6
6:2 3:6
6:2 1:6 6:8
출력
da
da
ne
da
ne
da
예제 2
입력
federer roddick
1
2:6 4:6
출력
ne
문제 정보

riseoj 작성

출처 COCI 2006/2007 Contest 5

평가 및 의견

Tenis

개요
출제자 난이도 Silver II 실버 II 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Tenis

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8