Judge (1) P14343


Statement
 

pdf   zip

thehtml

Consider the definition

struct Submission { string idn; string exer; int time; string res; };

for the results of the submissions done in the Judge of P1, where idn identifies the student who has done the sending (is a string of 9 digits), exer is the identifier of the exercise (a string of 4 or 5 characters), time is the moment of the sending (in seconds since the overture of the Judge), and res is the result of the sending, which can be “green”, “yellow” or “red”.

Consider also the definition

typedef vector<Submission> History;

to store all the submissions done in the Judge of P1. Two submissions never have the same field time.

Use these definitions in a program that reads all the submissions done in the Judge, and prints the following information:

  • The student with more green submissions. (the student with smallest idn in a event of a tie, “-” if there is not any green submission).
  • The student with more green exercises (the student with smallest idn in a event of a tie, “-” if there is not any green exercise).
  • The student with more red exercises (the student with smallest idn in a event of a tie, “-” if there is not any red exercise).
  • The student who has tried to solve (with or without success) more different exercises (the student with smallest idn in a event of a tie, “-” if there is not any submission).
  • The student who has done the last submission “-” if there is not any submission).

Input

Input consists of a natural n, followed by n submissions, each one in a line, with the fields in the same order than in the definition of the type. Suppose that there are, at most, 20 students, 50 exercises and 1000 submissions.

Output

Your program must print the five previously said idn with the corresponding counters following the format of the instance.

Observation

This exercise is quite long. To compensate, it is not necessary that the sent solution is particularly efficient.

Public test cases
  • Input

    15
    40123456 TIPIC 1000 red
    40123456 TIPIC 2000 yellow
    40123456 TIPIC 3000 green
    77777777 GABY  5100 yellow
    11223344 FOFO  2300 yellow
    11223344 FOFO  1500 red
    40123456 FOFO  5000 green
    40123456 FOFO  4000 green
    40123456 FOFO  4400 green
    11223344 TIPIC 9600 green
    11223344 KITO  9000 yellow
    11223344 GABY  8200 red
    77777777 KITO  6000 green
    77777777 FOFO  7000 green
    77777777 TIPIC 8000 green
    

    Output

    student with more green submissions:       40123456 (4)
    student with more green exercises:         77777777 (3)
    student with more red exercises:           11223344 (1)
    student with more tried exercises:         11223344 (4)
    student who has done the last submission:  11223344
    
  • Input

    1
    00110011 TIPIC 100 yellow
    

    Output

    student with more green submissions:       -
    student with more green exercises:         -
    student with more red exercises:           -
    student with more tried exercises:         00110011 (1)
    student who has done the last submission:  00110011
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++