luogu#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 -.}$
题目大意
题目描述
2000 年以前的秦朝,曾举办过一次 ICPC 比赛。比赛中有 道题, 个团队。我们知道每个队完成了多少道题以及其历史记录的总用时。这些称作该团队的结果,但是我们不知道他们每道题是否完成、用时多久。
最近,我们发现了每个队冻结的计分板。从该计分板上,我们可以看到每个队在比赛中的提交情况,但是不知道在最后一小时内提交的判分。一些人发现,对于一些队来说,他们冻结的计分板可能与他们在历史记录中的最终成绩相矛盾。
请根据最终得分和冻结的计分板,为各队创建一个与其最终结果和冻结的计分板一致的最终计分板。
按照以下规则来计算计分板和总分:
对于给定的队伍 ,它最终的计分板是一个 元数组,其中第 个元素给出队伍 在第 题上的提交信息。
-
如果队伍 没有提交问题 ,输出
.
。 -
如果队伍 对问题 提交了 次但均未通过,输出 。
-
否则,考虑队伍 在问题 的所有评测结果。每次提交都有一个提交时间,设第一个通过的评测是第 次评测,在第 分钟时提交。输出 ,其中 。
在最终计分板上,只考虑第一次通过的提交。同一分钟内可能有多次提交。
一个队伍的最终得分是该队伍完成了多少道题,即该队最终计分板上 +
的个数。
一个队伍总用时按如下方式计算。如果队伍 在第 分钟完成了第 道题,在完成前有 次失败的提交(即最终计分板上第 个问题的数为 ),该问题的用时记为 。 如果队伍 没有完成第 道题,该问题的用时记为 ,无论是否提交过。队伍 的总时间是每道题用时的总和。
输入格式
第一行包括两个整数 ,为队伍个数和题目个数。
接下来 组,描述每个队伍的最终得分和冻结的计分板。
第 组表示队伍 。每一组中,第一行包括两个整数 ,为队伍 在整场比赛中完成的题目个数和每道题的用时。这两个数字是比赛的最终结果。
接下来 行,描述队伍 在计分板上的内容。对于任意 ,
-
如果第 行是 ,表示队伍 在第 分钟,第 次提交时通过了题 。
-
如果第 行是 ,表示队伍 没有在前四个小时中作出题 。这个队伍提交了 次,其中 次在最后一小时内。最后一小时内且通过该题的提交记录会在冻结的计分板上显示,但不会在最终计分板上显示。
-
如果第 行是 ,表示队伍 没有在前四小时内作出题 。这个队伍在最后一个小时前提交了 次,且没有在最后一小时内做出题 。
-
如果第 行是一个单一的字符
.
,表示队伍 没有提交过题 。
输出格式
对于每个队伍 ,如果最终结果和冻结的计分板相矛盾,输出一行 。否则,第一行输出 ,接下来 行,描述一种队伍 可能的计分板,满足最终结果和冻结的计分板。其中,第 行应该包括:
-
,如果队伍 在第 次提交,第 分钟完成了题 ,在这之前没有队伍通过这道题。不要在字符
/
前后输出多余的空格。 -
,如果队伍 提交了 次题 ,且均未通过。
-
.
,如果队伍 没有提交题 。
如果有多种可能的答案,任意输出一种即可。
请注意,在输入和输出中,?,+,-
后总有一个空格。
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.