GFSSOC '17 J4 - Top Courses

View as PDF

Submit solution

Points: 7
Time limit: 1.0s
Memory limit: 128M

Authors:
Problem types
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 Waterloo admission office was DDOSed, which meant that Ace's marks couldn't be processed! Waterloo has sent Ace a form where he must fill in his marks onto. However, it isn't as simple as one would like. Ace has completed N (1 \le N \le 1\,000\,000) grade 12 courses (some aren't as legitimate as others...) with an unique course name, whose length will be no longer than 100 characters, and a grade (0 \le grade \le 100). Waterloo Software Engineering requires that applicants submit C courses and has M mandatory courses that Ace must include (1 \le M \le C \le 1\,000\,000). If Ace does not have enough courses to submit or does not have the mandatory courses, he will fail. Given Ace's grades, calculate the maximum entry average he can submit on his form. If he fails, output Ace is dunzos.

Input Specification

First line: three integers N, C, M.

Next N lines: a string with or without spaces representing the course name, and an integer grade.

Next M lines: a string with or without spaces representing the name of a mandatory course.

Output Specification

Ace's maximum possible average, rounded to 2 decimal places.

Sample Input 1

10 6 5
Chemistry 97
AdvFunc 96
CalcAndVectors 97
Physics 96
CurrentEcon 96
French 96
English 92
Literature 93
Science 98
Philosophy 87
Chemistry
Physics
AdvFunc
English
CalcAndVectors

Sample Output 1

96.00

Comments


  • 0
    leonchen0613  commented on Jan. 20, 2017, 12:54 p.m.

    Any hints on test cases 1-3?


    • 0
      tig567899  commented on Jan. 20, 2017, 1:19 p.m.

      Leon, the first 3 test cases have spaces in the name. That's the reason for your WAs


    • 0
      tig567899  commented on Jan. 20, 2017, 1:02 p.m. edited

      Our mistake, the course names may have spaces between them, I will update the specifications immediately.

      Edit: done


    • 0
      P234rex  commented on Jan. 20, 2017, 12:59 p.m. edited

      Edit: nvm yes, it was our fault


      • 0
        deleted  commented on Jan. 20, 2017, 7:53 p.m.

        the subj names under all the M cases has the same spacing as the ones previously typed in N right


        • -1
          P234rex  commented on Jan. 20, 2017, 8:13 p.m.

          Possibly ;) (since you're coding in python it shouldn't matter though)


  • 0
    tig567899  commented on Jan. 20, 2017, 12:12 p.m. edited

    I'm aware of the internal error and am fixing it immediately.

    Edit: Fixed