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

21242번 - Powerless Mage 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB522100.000%

문제

A mage knows $n$ spells, the $i$-th of which requires $q_i$ blue mana, $w_i$ purple mana and $e_i$ orange mana ($q_i + w_i + e_i > 0$). Let's say the mage has $Q$ blue mana, $W$ purple mana and $E$ orange mana, and denote the total amount of mana $Q + W + E$ as $R$. Knowing that the mage is unable to cast any spell, what can be the maximal value of $R$?

입력

The first line contains an integer $n$ (1ドル \le n \le 200000$) --- the number of spells.

Each of the next $n$ lines contains three integers $q_i,ドル $w_i,ドル $e_i$ (0ドル \le q_i, w_i, e_i \le 10^{9}, q_i + w_i + e_i > 0$) --- the manacosts of the $i$-th spell.

출력

Output the maximal total amount of mana $R$ such that the mage is unable to cast any spell.

If this number is infinitely large (for any total amount of mana $R,ドル there could be a situation so that the mage is unable to cast any spell), output "Infinity".

제한

예제 입력 1

4
0 0 100
0 100 0
100 0 0
61 71 81

예제 출력 1

278

예제 입력 2

6
0 0 100
0 100 0
100 0 0
0 11 61
11 61 0
61 0 11

예제 출력 2

180

예제 입력 3

3
3 1 1
1 3 1
1 1 3

예제 출력 3

Infinity

힌트

출처

Contest > Open Cup > 2020/2021 Season > Stage 8: Grand Prix of Samara E번

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

출처

대학교 대회

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

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