Logo
(追記) (追記ここまで)

33652번 - Testing LEDs 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB28319516068.966%

문제

LEDs are an amazing technology, in part due to their longevity. But they can’t last forever right? So you decide to put it to the test; you turn on an LED, and a machine periodically records the time in milliseconds since you started. Eventually it turns off! Your machine kept recording though, and unforunately your data is all jumbled up! What is the first time the machine recorded the LED being off?

Note that the LED may turn back on; you want to find the very first time the LED was recorded being off.

입력

The first line of input contains the integer $N$ (1ドル≤N≤10^5$). The following $N$ lines consist of 2ドル$ integers $M$ (0ドル≤M<2^{31}$) and $O$ ($O\in\{0,1\}$), where $M$ is the time this recording was taken in milliseconds, and $O$ denotes whether the LED was on or off. The number 1ドル$ corresponds to the LED being on, and 0ドル$ off.

출력

Output a single integer denoting the time of the first recording where the LED was off, or output $-1$ if it was never off for any recording.

제한

예제 입력 1

4
400 0
100 1
300 0
200 1

예제 출력 1

300

예제 입력 2

3
10 1
2010 1
150 1

예제 출력 2

-1

예제 입력 3

6
250 0
25 1
100 0
50 0
200 1
150 1

예제 출력 3

50

힌트

출처

University > University of Alberta Programming Contest > UAPC 2025 > Division 2 B번

  • 문제를 만든 사람: Noah Gergel
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /