#P3892. OJ Contest Management

    ID: 17140 Type: Default 1000ms 256MiB

OJ Contest Management

OJ Contest Management

This problem simulates the Contest module of an Online Judge (OJ) system. You are given a series of commands to manage contests, submissions, and rejudgings. The basic OJ elements include:

  • Problem: Identified uniquely by a positive integer pid.
  • Contest: Identified uniquely by a positive integer cid.
  • User: Identified uniquely by a positive integer uid.
  • Submission: Identified uniquely by a positive integer sid and consists of cid, pid, uid, and result.

There are four types of commands:

  1. createContest cid t pid_1 pid_2 \ldots pid_t — Create a contest with contest id cid and t unique problems. Here, $1\le t\le 1000$.
  2. submission sid cid pid uid result — Record a submission. The submission id sid is either new or previously rejudged. The result is either AC (accepted) or UNAC (not accepted).
  3. getRank cid uid — For contest cid, compute the ranking stats for user uid. All users with at least one submission (even if later rejudged) are ranked. The ranking is determined by the number of distinct problems solved (a problem is considered solved if there is at least one submission with result AC). If multiple users have the same count, any ordering is acceptable. Thus, the best possible rank (highest) for a given user is when they are placed ahead of all users with the same solved count, and the worst possible rank (lowest) is when they are placed behind. Output the result in the format: uid solved highest lowest. Note that if the user has not made any submissions in this contest, output uid 0 0 0.
  4. rejudge sid — Rejudge the submission with id sid by changing its result to WAIT. A submission with result WAIT does not count as a solved submission.

Note: A user may submit multiple times for the same problem; however, multiple accepted submissions (AC) for the same problem count as only one solved problem.

inputFormat

The input consists of several commands, one per line. Process until end of file (EOF). Each command is one of the following:

  • createContest cid t pid_1 pid_2 ... pid_t
  • submission sid cid pid uid result
  • getRank cid uid
  • rejudge sid

outputFormat

For each getRank command, output a line in the format uid solved highest lowest:

  • uid: the user id
  • solved: number of distinct problems solved
  • highest: the best possible rank
  • lowest: the worst possible rank

If the user has not made any submission in contest, output uid 0 0 0.

sample

createContest 1001 3 101 102 103
submission 1 1001 101 10001 AC
submission 2 1001 102 10001 UNAC
getRank 1001 10001
10001 1 1 1

</p>