Mackenzie New Year's Challenge P3 - ECOO!

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

The ECOO programming contest is coming up soon and it's about time to determine which teams will represent Mackenzie at ECOO. Siavash is curious if his team will be one of these teams. Help him determine the teams that will go to ECOO. Each school is able to send 2 general teams and 1 girls team. Any team type can qualify as a general team, but only girls teams can compete as a girls team. We will send the best teams possible from our school. To determine the best teams, we host the JDCC competitions. The higher a team's JDCC score, the better they are considered as a team at programming. Given all the team names, their scores on the JDCC and their team type (general or girls), output the name(s) of the team(s) representing Mackenzie at ECOO, in alphabetical order. If zero teams will represent Mackenzie, output No ECOO :(.

Input Specification

Input will begin with an integer 0 \le N \le 100, denoting N teams.

The next N lines will contain S, T, P, all separated by a single space. S is the team name, all uppercase letters only, at most 20 letters long. T is the team type, either general or girls. And P is the number of points that the team has 0 \le P \le 1\,000\,000. No two teams will have an equal number of points and no two teams will have the same team name.

Output Specification

The teams to send to ECOO in alphabetical order, each on a separate line, or No ECOO :( on a single line if no teams are to be sent.

Sample Input

6
A general 1001
H girls 849
G girls 850
B general 999
C general 950
D general 951

Sample Output

A
B
G

Explanation for Sample Output

Team G is the highest scoring girls team, so they will advance to ECOO. A and B are the two highest scoring general teams, so they also go to ECOO. A, B and G are the three teams that will go in alphabetical order.


Comments


  • 0
    Quality_of_Perfection  commented on Aug. 14, 2016, 3:26 p.m.

    Can someone please tell me why I'm getting 4/5. I read the problem many times and I still can't figure it out.Or can someone please give me a hint.


    • 1
      aurpine  commented on Aug. 16, 2016, 4:44 a.m.

      Edge cases :D Consider cases where there are very few teams and cases where there are only a certain amount of the types of teams.


  • 0
    fed80  commented on Dec. 31, 2015, 12:20 p.m.

    Is the score definetly integer?


    • 2
      HowAboutNo  commented on Dec. 31, 2015, 2:01 p.m.

      Yes.


      • 5
        bobhob314  commented on Jan. 8, 2016, 8:01 p.m.

        Username relevant.


  • 0
    DragonCav  commented on Dec. 30, 2015, 12:57 p.m.

    if there is no girl team, do we print "No ECOO :(" at the end with other two teams at the top?


    • 2
      aurpine  commented on Dec. 30, 2015, 12:59 p.m. edit 2

      Only print No ECOO :( if no (zero) teams will go to ECOO.

      Problem statement updated for better clarification.


  • 4
    kushanzaveri  commented on Dec. 30, 2015, 12:55 p.m.

    If there were two teams, both of which were general, does that mean that there is No ECOO because it doesn't satisfy the condition of having at least 1 girl team?


    • 0
      aurpine  commented on Dec. 30, 2015, 12:56 p.m.

      Each school is able to send 2 general teams and 1 girls team.

      Emphasis on able

      If no teams will represent Mackenzie, output No ECOO :(.

      Emphasis on no teams


  • 1
    XIAOAGE  commented on Dec. 30, 2015, 12:41 p.m.

    :)


    • -4
      aurpine  commented on Dec. 30, 2015, 12:55 p.m.

      Fixed the problem statement. (Oh, so it was 1,000,000)


  • 1
    kobortor  commented on Dec. 30, 2015, 11:56 a.m.

    4 A general 10 B general 20 C girls 500 D girls 499


    • 1
      aurpine  commented on Dec. 30, 2015, 12:11 p.m. edited

      Use your judgement.

      We will send the best teams possible from our school.

      and

      Any team type can qualify as a general team, but only girls teams can compete as a girls team.


  • 1
    vincentdmacri  commented on Dec. 30, 2015, 11:24 a.m.

    In Test Case #7, at least two teams have the same score.


    • 2
      aurpine  commented on Dec. 30, 2015, 11:39 a.m.

      Thanks for notifying us. The issue has been resolved. Submissions rejudged. Sorry for the inconvenience.


    • 3
      cheesecake  commented on Dec. 30, 2015, 11:37 a.m.

      Test data has been fixed, all submissions have been rejudged.