#P3892. [GDOI2014] OJ
[GDOI2014] OJ
Description
Xiao M is a diligent ACMer. He has solved many problems in his spare time. But he is very forgetful and often forgets which problems he has solved, so he wants to write an OJ to manage the problems he has done.
After a week of effort, Xiao M’s OJ is basically finished, except for a Contest module that has not been implemented. Xiao M thinks this module is hard to implement, so he wants you to help.
Xiao M tells you that the basic elements of an OJ include:
- Problem, uniquely identified by pid, where pid is a positive integer.
- Contest, uniquely identified by cid, where cid is a positive integer.
- User, uniquely identified by uid, where uid is a positive integer.
- Submission status, uniquely identified by sid, where sid is a positive integer.
A submission status consists of sid, cid, pid, uid, and result, representing the submission ID of this entry, the contest ID it belongs to, the problem ID, the user ID, and the judging result.
For simplicity, result has only three states: AC, UNAC, and WAIT, meaning accepted, not accepted, and waiting for judge, respectively.
Meanwhile, the contest module needs to support the following requests:
createContest cid t pid_1 pid_2 … pid_t
This creates a contest. The cid is a positive integer and is the unique identifier of this contest.
Here indicates there are problems () in this contest, followed by distinct integers denoting the problem IDs of this contest.
submission sid cid pid uid result
The sid of this status either has not appeared before, or it has appeared before but was rejudged.
The result is AC or UNAC.
getRank cid uid
In a contest, all users who have any submission should be included in the ranking (including submissions that have been rejudged). Users are ranked by the number of solved problems in descending order; if the solved count is the same, the tie-breaking is random.
This command needs to report the number of problems solved by user uid in contest cid, their best possible rank and worst possible rank.
Note that multiple accepted records on the same problem by user uid in contest cid count only once.
The output format is: uid solved highest lowest.
These represent the user ID, solved problem count, highest rank, and lowest rank, with .
rejudge sid
Rejudge the submission identified by sid, i.e., set its result to WAIT.
Input Format
The first line contains three integers , , and ($1 \le \mathit{pcnt} \le 5000, 1 \le \mathit{ucnt} \le 5000, 1 \le m \le 3 \times 10^5$), indicating that the OJ has problems, users, and requests.
The range of pid is , the range of uid is , the range of cid is , and .
Then there are lines, each containing one request, which is one of the four types described above. Requests should be executed in the input order.
You should note the following:
- For a
createContestrequest, cid will not duplicate any previous createContest’s cid. - For a
submissionrequest, before this request, the contest cid has already been created, and pid is one of the problems in that contest. - For a
getRankrequest, before this request, the contest cid has already been created, and user uid has at least one submission record in that contest. - For a
rejudgerequest, before this request, a submission identified by sid exists.
Output Format
For each getRank request, output the user ID, solved problem count, highest rank, and lowest rank, separated by single spaces.
7 5 17
createContest 1 5 1001 1004 1002 1005 1006
submission 1 1 1001 1 AC
submission 2 1 1001 1 AC
submission 3 1 1001 2 UNAC
submission 4 1 1003 3 UNAC
getRank 1 1
getRank 1 2
getRank 1 3
rejudge 3
submission 3 1 1001 2 AC
getRank 1 2
submission 5 1 1006 2 AC
getRank 1 1
submission 6 1 1006 2 UNAC
getRank 1 2
rejudge 5
getRank 1 2
1 1 1 1
2 0 2 3
3 0 2 3
2 1 1 2
1 1 2 2
2 2 1 1
2 1 1 2
Hint
For of the testdata, .
For of the testdata, $1 \le \mathit{pcnt}, \mathit{ucnt} \le 2000, 1 \le m \le 50000$.
For of the testdata, $1 \le \mathit{pcnt}, \mathit{ucnt} \le 5000, 1 \le m \le 3 \times 10^5, 1 \le \mathit{cid} \le 50$.
Translated by ChatGPT 5
京公网安备 11011102002149号