e-Vaccine

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Time Limit: 2.0 s

Memory Limit: 256.0 MB

Description

The Government is planning to roll out the new vaccine to slow down the spread of the virus. But as the demand for vaccine is greater than the production, Government needs your help to distribute the vaccine.

Government has decided to prioritize the rollout of vaccine by Job and Age.

Age from \(1\) to \(125\) will be divided into \(G\) age groups.

Each age group may or may not have a different priority. There will be \(J\) jobs in the priority jobs list. Each job on the list may or may not have a different priority. Jobs not in the priority jobs list will have a priority of \(0\).

Priority of the person will the sum of the priority of their job and age. If two people have the same priority, one who was eligible first will have the vaccine.

The distribution program will run for \(D\) days, and each day \(N\) new people will be eligible for the vaccine and the Government will produce \(M\) vaccine.

End of the \(D\) days, let the Government know how many people remains unvaccinated.

Input

The first line of the input will have three integers, \(D (1 <= D <= 10^4), J (1 <= J <= 150), G (1 <= G <= 7)\).

Next \(J\) line will have the name of job and priority.

Next \(G\) will have \(3\) numbers, \(l\), \(u\), and \(p\). The lower and upper limit of the age group, and the priority. Next for each day, \(D\).

There will an integer, \(N (1 <= N <= 5 * 10^5)\), number of people that became eligible that day, and \(M (0 <= M <= 5 * 10^5)\), number of new vaccines produced by the Government.

Next, \(N\) line will have the name of the person and their job.

Sum of all \(N\) will be less then or equal to \(5 * 10^5\)

Output

For each of \(D\) days, print the name and job of the person receiving the vaccine.

After \(D\), also let the Government know, the number of unvaccinated people in the following format.
Still unvaccinated people: \(X\)

\(X\) here being the number of unvaccinated people.

Sample

Input Output
3 2 5
Doctor 2
Nurse 1
1 12 1
13 25 2
26 40 2
41 63 3
64 125 4
4 2
James Engineer 45 
Jonah Doctor 24
Hillary Nurse 43
Alex Nurse 44
1 1
Gandhi Doctor 24
2 3
Walker Engineer 45 
Xavier Businessman 67
Jonah Doctor 24
Hillary Nurse 43
Alex Nurse 44
Gandhi Doctor 24
Xavier Businessman 67
James Engineer 45
Still unvaccinated people: 1

LU IUJPC : Sylhet Division 2024 Replay Contest

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
11
Start at
2024-12-10 09:00
End at
2024-12-10 14:00
Duration
5.0 hour(s)
Host
Partic.
63