#K64562. Analyze Online Coding Contests

    ID: 32003 Type: Default 1000ms 256MiB

Analyze Online Coding Contests

Analyze Online Coding Contests

You are given a series of online coding contests. For each contest, you need to determine two things:

  • The hardest problem solved by at least one participant, which is the maximum difficulty among the solved problems. If no problem has been solved, output None Solved.
  • The easiest problem not solved by any participant, which is the minimum difficulty among the unsolved problems. If all problems were solved, output All Solved.

The contest information is provided as follows:

  • The first line contains an integer $T$, the number of contests.
  • For each contest:
    • The first line contains an integer $P$, the number of problems in the contest.
    • The second line contains $P$ integers in ascending order representing the difficulty levels of the problems.
    • The third line contains a space‐separated list of integers representing the difficulty levels of the solved problems. This line may be empty if no problem was solved.

For each contest, output a single line containing two values separated by a space: the hardest solved problem and the easiest unsolved problem. If all problems are solved, the easiest unsolved problem is All Solved.

inputFormat

The input is read from standard input (stdin) and consists of multiple lines. The format is:

T
P
p1 p2 ... pP
[s1 s2 ... sK]
... (repeat for each contest)

where:

  • T is the number of contests.
  • For each contest, P is the number of problems.
  • The next line lists P integers (in ascending order) representing the difficulty levels of the problems.
  • The following line lists the difficulties of solved problems; it can be empty if no problems were solved.

outputFormat

For each contest, output one line to standard output (stdout) containing two values separated by a space:

  • The hardest solved problem (or None Solved if no problem was solved).
  • The easiest unsolved problem (or All Solved if every problem was solved).
## sample
2
5
1 2 3 4 5
2 4
3
10 20 30
10 20 30
4 1

30 All Solved

</p>