RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00410

Go

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

1 \(s / 32\) \(MB / 50\) points

Mirko quickly got tired of Jetpack Joyride and started playing Pokémon GO! on his phone.

One of the curiosities of this game is the \(so-ca\)lled evolution

of Pokémon.

In order to evolve Pokémon of species \(P\)

\(i\)

, Mirko must provide \(K\)

_{i} ^{candy} ^{intended} ^{for} ^{a}

Pokémon of that species. After the evolution of that Pokémon, he gets 2 candies back.

Pokémon can evolve only with the help of candy intended for their species.

Mirko has \(N\) species of Pokémon and \(M\)

_{i} ^{candy} ^{for} ^{Pokémon} ^{of} ^{species} ^{ }^{P}

_{i} ^{and} ^{wants} ^{to}

know how many total Pokémon he can evolve.

He also wants to know which Pokémon can evolve the most number of times. If there are

multiple such Pokémon, output the one with the smallest Pokédex number. In other words,

the one that appears earliest in the input data.

제약

In test cases worth 16 points total, it will hold \(N\)

= 3.
The first line of output will count towards 50% of points for that test case.
The second line of output will count towards 50% of points for that test case.

1 \(s / 32\) \(MB / 50\) points

입력 형식

The first line of input contains the integer \(N\)

(1 ≤ \(N\)

≤ 70), the number of Pokémon species.
The following 2 \(N\)

lines contains \(N\)

sets of data, wherein it holds:

line 2 \(i\) contains string \(P\)

\(i\)

, 20 characters long at most, the name of the \(i\)

^{th} Pokémon

species;

line 2 \(i\)

+1 contains integers \(K\)

_{i} ^{ }^{(12} {≤}{ }^{K}

_{i} ^{≤400)} ^{and} ^{ }^{M}

_{i} ^{(1} {≤}{ }^{M}

_{i} {≤10}{ }{4}{ }^{),} ^{the} ^{number} ^{of}

candy necessary for the evolution of one Pokémon of the \(i\)

^{th} species and the total

number of candy Mirko has for Pokémon of the \(i\)

\(th\)

species

출력 형식

The first line of output must contain the total number of Pokémon that Mirko can evolve.
The second line of output must contain the name of the Pokémon that can evolve the most
number of times.

예제 1
입력
4
Caterpie
12 33
Weedle
12 42
Pidgey
12 47
Rattata
25 71

7
Bulbasaur
25 74
Ivysaur
100 83
Charmander
25 116
Charmeleon
100 32
Squirtle
25 1
Wartortle
100 173
Pikachu
50 154
출력
output
14
Weedle

11
Charmander
설명

Clarification of the first test case:
Let’s describe how Mirko evolved Weedles. For Weedles’ first evolution, Mirko spent 12 candy, but got

back 2, so he has 32 candy left (42-12+2). After the second evolution, he is left with 22 candy. After the

third evolution, he had 12 candy, which was enough for just one more evolution. This way, Mirko evolved

4 Weedles.

Similarly, we see that Mirko can evolve at most 3 Caterpies, 4 Pidgeys and 3 Rattatas.

Out of all Pokémon, Weedle and Pidgey evolved the most number of times, but Weedle’s Pokédex

number is smaller (it appears earlier in the input data), so it is the solution of the second part of the task.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2016/2017 Contest 2

평가 및 의견

Go

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Go

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8