#P9670. [ICPC2022 Jinan R] Frozen Scoreboard
[ICPC2022 Jinan R] Frozen Scoreboard
题目描述
There was an ICPC contest two thousand years ago in the Qin dynasty. There were problems and teams in the contest. We only know how many problems each team solved and how much total time they used from the historical records. These are called the s of the teams. We don't know which problems they solved or their submission times.
Recently, we seem to had a discovery. We found the of the teams. From the frozen scoreboard of a team, we know their submissions during the whole contest, but we don't know the verdicts of the submissions in the last hour. And some people found that for some teams, their frozen scoreboards may contradict their final results in the historical records.
Given the final results and the frozen scoreboards of the teams, please construct a for each team that is consistent with both its final result and its frozen scoreboard.
From the submissions during the contest, we can calculate the final scoreboard and the final result as follows:
For a fixed team , its is an array of elements where the -th element shows some information about team 's submissions on problem .
-
If team didn't submit to problem , the cell should be a single character
.
(without quotes). -
If team submitted times to problem and none of the submissions was accepted, the cell should contain .
-
Otherwise, consider all submissions from team to problem . Each submission has a submission time. Suppose the earliest accepted submission is the -th one. Then the cell should contain where is the submission time of the -th submission. is an integer representing the submission time in minutes.
Note that in the final scoreboard, we don't care about submissions after the first accepted one. It is possible that two or more submissions happened in the same minute.
The of a team is computed from its . For each team, we can calculate the number of problems it solved. This number is equal to the number of +
in the team's final scoreboard.
We can also calculate its total time. If team solved problem in the -th minute after unaccepted submissions (in other words, the -th cell of its final scoreboard is ), problem contributes time to team . If team didn't solve problem , problem contributes time to team , no matter team submitted to problem or not. The total time of team is the sum of contributions of each problem.
The rules for the will be introduced in the input section. We will distinguish submissions in the final hour and other submissions. A submission was in the final hour if its submission time is between and .
输入格式
The first line contains two integers , the number of teams in the contest, and the number of problems in the contest.
Then there are blocks describing the and the of each team.
The -th block represents team . In the -th block, the first line contains two integers , the number of problems team solved and the total time of team for solving the problems. These two numbers represent the final result of the contest. The next lines describe the status of team in the frozen scoreboard. For each ,
- If the -th line is , team solved problem at time and the accepted solution is their -th submission on problem .
- If the -th line is , team didn't solve the problem in the first four hours. Team submitted problem for times in which submissions are in the last hour. Note that submissions made in the last hour after the accepted one will count in the , but not in the .
- If the -th line is , team didn't solve the problem in the first four hours. Team submitted problem for times before the last hour and did not submit problem in the last hour.
- If the -th line is a single character
.
(without quotes), team didn't submit problem at all.
输出格式
For each team , if its final result contradicts its frozen scoreboard, output in one line. Otherwise, output in the first line and then output lines, describing a final scoreboard that is consistent with both the final result and the frozen scoreboard of team . The -th line should contain
- , if the -th submission from team to problem is accepted and is in the -th minute of the contest. All submissions from team to team before the -th one was not accepted. Please don't output extra spaces before and after slash
/
. - , if team submitted to problem for times and none of the submissions was accepted.
- if team didn't submit to problem at all.
If there are multiple solutions, output any.
$\textbf{Please note that in the input and the output, there is always a space following each ?, +, and -.}$
1 13
7 951
+ 1/6
? 3 4
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.
Yes
+ 1/6
+ 2/263
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.
6 2
1 100
.
? 3 4
2 100
+ 1/1
+ 1/2
0 0
- 5
- 6
2 480
? 100 100
? 100 100
2 480
? 99 100
? 100 100
1 2000
? 100 100
? 100 100
No
No
Yes
- 5
- 6
Yes
+ 1/240
+ 1/240
No
Yes
+ 87/280
- 100
提示
Here is an example of the frozen scoreboard in the first sample.