-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50eb57b
commit 24d3faa
Showing
5 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import sys | ||
|
||
registered = set() | ||
amigo = '' | ||
|
||
for line in sys.stdin: | ||
if line.strip() == 'FIM': | ||
break | ||
|
||
name, answer = line.strip().split() | ||
if len(name) > len(amigo) and answer == 'YES': | ||
amigo = name | ||
|
||
registered.add((0 if answer == 'YES' else 1, name)) | ||
|
||
|
||
print('\n'.join(map(lambda x: x[1], sorted(registered)))) | ||
print() | ||
print('Amigo do Habay:') | ||
print(amigo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Ana YES | ||
Luana YES | ||
Frederico YES | ||
Julia YES | ||
Felipe YES | ||
Ricardo NO | ||
Carlos YES | ||
Jessica YES | ||
Maria YES | ||
Ana YES | ||
João NO | ||
Mariane NO | ||
Felipe YES | ||
Carlos YES | ||
Luana YES | ||
Jessica YES | ||
Beatriz NO | ||
Mateus NO | ||
Ana YES | ||
Julia YES | ||
Tiago NO | ||
Frederico YES | ||
Luana YES | ||
Maria YES | ||
Ana YES | ||
FIM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Ana | ||
Carlos | ||
Felipe | ||
Frederico | ||
Jessica | ||
Julia | ||
Luana | ||
Maria | ||
Beatriz | ||
João | ||
Mariane | ||
Mateus | ||
Ricardo | ||
Tiago | ||
|
||
Amigo do Habay: | ||
Frederico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
https://judge.beecrowd.com/en/problems/view/2136 | ||
|
||
# Friends of Habay | ||
|
||
Every end of year there is a party in Fantastic Education Institution (FEI). | ||
Early in July, the registration is open to take part in it. At registration, the | ||
user can choose whether to be "O Amigo do Habay" (The Friend of Habay) in the | ||
party or not. The most logical choice would be Yes, because it is a privilege to | ||
be The Friend of Habay, since he is the coolest person in FEI. However, there | ||
are some people who definitely don't want to be The Friend of Habay, and for | ||
unknown reasons. | ||
|
||
Only one will be chosen. As a result, many students who chose the option Yes | ||
registered several times to increase their chance of being The Friend of Habay. | ||
The party organizer hired you to organize the website's registration, since | ||
there is a registration spam going on. The criteria to be the chosen one is the | ||
number of letters of the first name, and if there is more than one name with the | ||
same number of letters, wins the one who first registered. The final | ||
organization of the registered users should follow the order of choice (Yes or | ||
No), while respecting the alphabetical order. | ||
|
||
Note: No one who chose the option No registered more than once. | ||
|
||
## Input | ||
|
||
The input consists of a single test case. Each line consists of the user's first | ||
name (no spaces), followed by the option YES (if the user wants to be O Amigo do | ||
Habay, i.e., The Friend of Habay) or NO (if the user doesn't). Read input until | ||
the user enters "FIM" (without quotes). | ||
|
||
|
||
## Output | ||
|
||
Print the registered users in order of choice, respecting the alphabetical | ||
order, then print the winner's name. Print a blank line between the list of | ||
registered users and the winner's name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data structures and libraries, sorting |