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

30303번 - Roulette 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB138191720.482%

문제

You are a big fan of Korea’s biggest rockstar, Koosaga. Excitingly, Koosaga has announced a lottery event offering fans an once-in-a-lifetime opportunity for an one-on-one meeting.

Koosaga sells $N$ kinds of his albums. When you purchase the $i$-th album, it costs you $A_i$ won and you get $B_i$ lottery tickets. Remember, you can purchase multiple copies of the same album if you wish.

On the day of the draw, a large roulette wheel containing cells with participant names, will decide the winner. Every cell on the wheel has an equal chance of being selected. The number of cells with your name corresponds to the number of lottery tickets you’ve amassed.

Koosaga will give the wheel a single spin to pick the winner. But even if luck isn’t on your side, there’s still hope! By paying $R$ won, you can request Koosaga to spin the wheel again. You can pay for as many re-spins as you desire.

Armed with insider knowledge, you’ve learned that the cumulative number of cells attributed to other participants is $S$. You also have learned that none of them will opt for a re-spin. Only you will request a re-spin, if wanted.

Your challenge is to find an optimal strategy to guarantee your win with the minimum expected cost.

입력

The first line contains space-separated three integers, $N,ドル $S,ドル $R$.

The next $N$ lines contain space-separated two integers, the $i$-th line contains $A_i,B_i$.

출력

Print a single line consists of space-separated two positive integers $X,ドル $Y$.

$\frac{X}{Y}$ must be the minimum expected cost to win and $X$ and $Y$ must be coprime. It can be proven that the minimum expected cost can be expressed in this format.

제한

  • 1ドル\le N\le 100,円 000$
  • 1ドル\le S\le 10^6$
  • 1ドル\le R\le 10^6$
  • 1ドル\le A_i\le 300\ (1\le i\le N)$
  • 1ドル\le B_i\le 5,円 000\ (1\le i\le N)$

예제 입력 1

3 11 3
1 3
2 7
5 13

예제 출력 1

63 10

힌트

출처

University > KAIST > KAIST ICPC Mock Competition > 2023 KAIST 13th ICPC Mock Competition L번

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 2: K-ontest L번

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

출처

대학교 대회

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

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