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

22259번 - Fraud 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB181563931.707%

문제

You have been put in charge of the 24th National Olympiad in Informatics!

This year, the competition consisted of N contestants and 2 rounds. The ith contestant scored Ai points in the first round and Bi points in the second round.

Furthermore, the rounds have associated positive integer weightages X and Y respectively. The ith contestant’s final score Si is given by Si = Ai × X + Bi × Y.

As the chairman, you have been given the freedom to select the values of X and Y as you wish.

Alas, Squeaky the Mouse has bribed you into committing fraud. To be exact, he has promised to reward you handsomely if you select some X and Y such that Si > Sj for all 1 ≤ i < j ≤ N.

But is it even possible to do so?

입력

Your program must read from standard input.

The first line contains a single integer N, the number of contestants.

The second line contains N space-separated integers, A1, . . . , AN.

The third line contains N space-separated integers, B1, . . . , BN.

출력

Your program must print to standard output.

Output YES if it is possible to commit fraud and NO otherwise.

제한

  • 2 ≤ N ≤ 3 × 105
  • 0 ≤ Ai, Bi ≤ 106

서브태스크

번호배점제한
110

Bi = 0

225

N = 2

350

2 ≤ N ≤ 104

415

예제 입력 1

2
1 2
2 1

예제 출력 1

YES

A possible solution is X = 1 and Y = 2.

This is since S1 = 1 × 1 + 2 × 2 = 5 > S2 = 2 × 1 + 1 × 2 = 4.

예제 입력 2

3
2 4 3
4 2 3

예제 출력 2

NO

예제 입력 3

2
5 1
0 0

예제 출력 3

YES

힌트

출처

Olympiad > National Olympiad in Informatics (Singapore) > NOI 2021 A번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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