Jumbled Scoreboards

면접 대비

시간 제한1초메모리 제한1024 MB

요약
n개의 점수판 쌍 (a, b)이 주어질 때, 각 팀의 점수가 줄어들지 않는 순서로 주어졌는지 판별한다.
난이도

쉬움10점 중 3점

유형
배열, 구현, 시뮬레이션, 그리디
정답자
아직 제출이 없습니다

문제

You were so hyped to attend the final game of the Ball And Paddle Competition, where the two best teams in the world compete to paddle as many balls into the opponent's goal as possible. But alas, you fell ill, and cannot join your friends. Luckily, your friends took lots of pictures during the match, and after the match concluded, they sent you all the pictures that they have. Because the messaging app uploads and downloads the pictures in parallel, you are wondering whether you received them in chronological order. It looks like the scoreboards in each picture are unique, and knowing that the score of a team can only increase over time, you should be able to figure this out. Feeling too sick to check the order of the pictures manually, you decide to write a program that checks temporal consistency based on the scoreboards that are in the picture.

Given a list of intermediate scores from the match, determine whether the scores are in chronological order.

입력

The input consists of:

  • One line with an integer nn (1≤n≤1001\leq n\leq 100), the number of pictures you received.
  • nn lines, each with two integers aa and bb (0≤a,b≤1000 \leq a,b \leq 100), the scores of the two teams in one of the pictures.

Every pair of scores (a,b)(a, b) in the input is unique.

The order of the scores in the input is the order in which you received the pictures.

출력

Output "yes" if the scores are in chronological order, or "no" if they are not.

예제3

  1. 예제 1

    입력
    4
    1 0
    2 0
    4 0
    4 1
    
    예상 출력
    yes
    
  2. 예제 2

    입력
    3
    0 0
    1 0
    0 2
    
    예상 출력
    no
    
  3. 예제 3

    입력
    5
    1 2
    0 0
    4 3
    2 3
    5 5
    
    예상 출력
    no