시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 0 | 0 | 0 | 0.000% |
Recently, Mr. Hamsadeh is working as an IT engineer in the central traffic control department of Tehran municipality. He is now in charge of a new traffic surveillance system with which the law-breaking vehicles are going to be fined through automatic plate detection and issuing penalty tickets. The system has been running for a few weeks in the production environment and now is the time for Mr. Hamsadeh to issue the tickets. While he was preparing the system, the persistence storage of the database server came into a fatal hardware crash and all its data was disastrously lost. Laughing at his own misery, misfortunate Mr. Hamsadeh started inspecting the other systems in hope of data-recovery. The only available pieces of information are the log files remaining in the application server. Fortunately, all forms of data-entry are logged in the service layer of the application server, and thus, the lost information can be totally survived using the log files. But such data-recovery tasks are too complicated for Mr. Hamsadeh and there is not enough time to setup a new database, import the recovered data and reconfigure the whole architecture for issuing the tickets. With deep feelings of being squashed, Mr. Hamsadeh is asking you for help. You have to write a program that reads all the log files and issues the penalty tickets. In the following paragraphs, Mr. Hamsadeh describes Tehran traffic regulations, services provided by the traffic surveillance system, the format of log files, and the rules for issuing tickets.
Each road is considered in one of the three traffic-specific zones of Tehran:
Ordinary personal vehicles are not normally permitted to enter CTRZ during these time intervals:
Ordinary personal vehicles whose vehicle registration number ends with an even digit are not permitted to enter EORZ during these time intervals:
Ordinary personal vehicles whose vehicle registration number ends with an odd digit are not permitted to enter EORZ during these time intervals:
So, none of these zone restrictions are applied on Fridays (official weekends in Iran). Some vehicles (including public transportation and emergency services) are allowed to enter CTRZ and EORZ anytime with no restrictions. Ordinary vehicles can also enter these zones if they buy the permission for a single day, but you are not to consider buying permissions in this problem. If a vehicle enters CTRZ or EORZ unlawfully, it should be fined. Each vehicle must be fined at most once a day for zone restriction violations. If both CTRZ and EORZ violations happen for a vehicle on a single day, the CTRZ violation is considered which has naturally a higher penalty. Each road is initially considered to be in UZ, but this state may change based on announcements. The new rules of all such announcements must be applied
from the day after the announcement. In the same way, no vehicles are initially exempt from zone regulations, but the exceptions are added and removed over time. Such modifications must also be considered from the next day.
The following are the services provided by the application server. Each service has a corresponding log message which is written on a single line starting with the service name followed by the parameters. As you will see in service definitions and examples, the parameters of a service are printed in a specific order. Independent of the service type, the parameter list of each log message starts with a special pair of parameters (called timestamp): “day” and “time”. A timestamp naturally shows the exact time of its corresponding service request. Parameter “day” is a positive integer showing the number of days passed from the day of system deployment (called day 0). Parameter “time” shows the
time of the request on that day in “HH:mm:ss” format (00 ≤ HH ≤ 23, 00 ≤ mm,ss ≤ 59).
You can assume the following statements:
The vehicles must be fined based on photo analysis results. As stated before, zone-entrance penalty tickets should be issued for each vehicle at most once a day. All photos of such a violation in a day must be attached to its corresponding penalty ticket. Photo attachments of a ticket must be sorted in ascending order based on their times. Note that if both
CTRZ and EORZ entrances happen together for a vehicle, all photos of both violations must be attached, but the ticket should be issued with the CTRZ penalty. The order of printed tickets is also important. Tickets must be primarily sorted based on their vehicles such that their registration numbers appear in lexicographic order. Tickets of a vehicle must then be sorted in ascending order based on the day of offence.
The input consists of several test cases. Each test case starts with a line containing the single integer N, the total number of lines in the log files (1 ≤ N ≤ 1000). The second line contains a string W followed by two positive integers CTP and EOP. String W is one of the words “Saturday”, “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, or “Friday”, specifying the weekday of the deployment day (day 0). Numbers CTP and EOP are the penalty values for outlawed entrance to CTRZ and EORZ respectively (EOP < CTP). Each of the next N lines contains a service log in the format specified before. The logs are not necessarily sorted in any special order as it is the concatenation result of many log files. Each line has at most 1000 characters. All integers in the input are less than 109. The input terminates with a line containing “0” (omit the quotes).
For each test case, you have to print the penalty tickets in the formerly-specified order. Each ticket has a main body and one or more attached photos. The main body must be printed first in a single line with the following format:
vehicle: "NUMBER", day: DAY, offence: "OFFENCE", penalty: PENALTY
Here is the meaning of the placeholders in this template:
Each photo attachment must appear in a separate line. They must be printed in the order specified before. Photo attachments must have the format below:
photo: PHOTO-ID, time: "TIME", road: "ROAD"
Here is the meaning of the placeholders in the template of photo attachments:
Follow the specified formats precisely, especially the order of parameters, spacing, punctuations, and quotation marks. Print a line containing “###” between every two consecutive test cases.
6 Friday 30000 25000 setRoadZone 1 "09:12:53" "CTRZ" "Enghelab" "Ferdowsi" "Behesht" setRoadZone 1 "14:32:01" "EORZ" "Resalat" "Damavand" addZoneException 1 "09:00:13" "1000100" "1000200" "1000300" addPhotoInfo 2 "13:18:43" 1004 "Enghelab" "1000100" "1000200" "1000400" "1000105" addPhotoInfo 3 "11:55:12" 1003 "Behesht" "1000400" "1000105" addPhotoInfo 2 "06:30:00" 1002 "Resalat" "1000100" "1000105" "1000120" "1000400" 3 Sunday 100 90 setRoadZone 4 "01:02:03" "CTRZ" "16-e_Azar" addPhotoInfo 4 "10:15:13" 211 "16-e_Azar" "1010101" addPhotoInfo 5 "20:21:42" 212 "16-e_Azar" "2020202" 6 Monday 1000 900 setRoadZone 13 "09:00:00" "CTRZ" "Azadi" addPhotoInfo 13 "10:00:00" 101 "Azadi" "1000001" addPhotoInfo 14 "10:00:00" 102 "Azadi" "1000001" setRoadZone 15 "09:00:00" "UZ" "Azadi" addPhotoInfo 15 "10:00:00" 103 "Azadi" "1000001" addPhotoInfo 16 "10:00:00" 104 "Azadi" "1000001" 0
vehicle: "1000105", day: 2, offence: "Outlawed entrance to CTRZ", penalty: 30000 photo: 1004, time: "13:18:43", road: "Enghelab" vehicle: "1000105", day: 3, offence: "Outlawed entrance to CTRZ", penalty: 30000 photo: 1003, time: "11:55:12", road: "Behesht" vehicle: "1000120", day: 2, offence: "Outlawed entrance to EORZ", penalty: 25000 photo: 1002, time: "06:30:00", road: "Resalat" vehicle: "1000400", day: 2, offence: "Outlawed entrance to CTRZ & EORZ", penalty: 30000 photo: 1002, time: "06:30:00", road: "Resalat" photo: 1004, time: "13:18:43", road: "Enghelab" vehicle: "1000400", day: 3, offence: "Outlawed entrance to CTRZ", penalty: 30000 photo: 1003, time: "11:55:12", road: "Behesht" ### ### vehicle: "1000001", day: 14, offence: "Outlawed entrance to CTRZ", penalty: 1000 photo: 102, time: "10:00:00", road: "Azadi" vehicle: "1000001", day: 15, offence: "Outlawed entrance to CTRZ", penalty: 1000 photo: 103, time: "10:00:00", road: "Azadi"
ICPC > Regionals > Asia West Continent > Iran > Tehran Site 2013 D번