DMOPC '15 Contest 7 P1 - Kemonomimi Competition

View as PDF

Submit solution


Points: 7 (partial)
Time limit: 1.0s
Java 8 2.5s
Python 2.5s
Memory limit: 64M
Java 8 256M
Python 256M

Author:
Problem type

FatalEagle is participating in the Educational Computing Olympiad for Otakus (ECOO). It seemed to him that he was in yet another ordinary competition to fly through when he realizes that his 4 other teammates are kemonomimi.

The contest consists of N problems, with a maximum of 2 submissions available per problem per team. While FatalEagle was napping, his teammates started without him! Each of the N problems was attempted exactly once, with the i^{th} kemonomimi's submission for the j^{th} problem receiving P_j points.

FatalEagle is able to concurrently solve all N problems provided that he has enough time. However, just the thought of having such beautiful anthropomorphic females on the same team as himself is enough to drive FatalEagle insane! Each of the kemonomimi i has her own cuteness factor C_i which increases the time he takes to produce his solution by C_i\times.

Having exhausted all of their energy, the kemonomimi could no longer concentrate on the tasks at hand and called upon their teammate FatalEagle to finish the contest. Not wanting to waste any more of the time remaining of the original 3 hours, FatalEagle would really like to know how many additional points he can earn.

Input Specification

The first line of input contains N (1 \le N \le 10).

The second line of input contains 4 space-separated integers C_i (1 \le C_i \le 10), representing the cuteness factor of the i^{th} kemonomimi.

The next N lines contain 4 space-separated integers i, P_j, S_j, T_j describing the j^{th} problem:

  • i (1 \le i \le 4), identifying the kemonomimi who worked on the first submission of this problem;

  • P_j (0 \le P_j \le 10), the amount of points (out of a maximum of 10), the first submission received;

  • S_j (0 \le S_j \le 180), the time elapsed in minutes from the start of the competition to the end of the first submission;

  • T_j (0 \le T_j \le 20), the amount of time in minutes FatalEagle needs to finish coding the solution to the problem undisturbed;

Output Specification

Output N lines, the j^{th} of which represents the number of additional points FatalEagle can earn concurrently for the j^{th} problem.

Output The kemonomimi are too cute! instead if the problem cannot successfully be solved in time.

Sample Input

3
1 3 6 9
2 1 0 20
3 3 120 1
4 9 75 12

Sample Output

9
7
The kemonomimi are too cute!

Explanation for Sample Output

FatalEagle starts programming concurrently 2 hours after the start of the competition! The kemonomimi woke him up after their last submission, 120 minutes into the competition.

The second kemonomimi contributed to the first problem and her lingering aura of cuteness triples the time taken for FatalEagle to type up a solution; Therefore, it takes 20 \times 3 = 60 minutes to solve this problem, finishing just as the contest ends!

The second problem was attempted by the third kemonomimi, taking 1 \times 6 = 6 minutes to solve.

Unfortunately, the cuteness of the fourth kemonomimi was just too much for FatalEagle to bear, and he is unable to solve the third problem in time.


FatalEagle jolts awake in his bed, drenched in sweat. What a horrible nightmare!

...

nyah~


Comments


  • 2
    echofox  commented on Feb. 16, 2018, 2:49 p.m.

    kemonomimi

    horrible nightmare

    discrepancy detected


  • 2
    bobhob314  commented on April 12, 2016, 9:18 p.m.

    kyaaan~


  • 3
    spencereir  commented on April 12, 2016, 9:08 p.m. edited

    To clarify, the time at which FatalEagle begins working on the problems concurrently is the latest of all the submission times? So if S = [3, 10, 20, 50, 2], he would start at 50 minutes?


    • -2
      Phoenix1369  commented on April 12, 2016, 10:24 p.m.

      Yes he would. As the Explanation for the Sample Output states, for S = [\ 0, 120, 75\ ], he would begin 120 minutes into the competition.