시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 11 | 3 | 3 | 30.000% |
Lim Li loves anime, and has recently bought a complete season of Umaru from Amazon. The N episodes of Umaru comes in a set of N CDs, with one episode in each CD. The CDs are labelled 1, . . . , N, and the episodes of Umaru are also numbered 1, . . . , N. She was prepared to begin watching, when she realised that due to a manufacturing fault, the episode numbers don’t match up with the labels on the CDs!
She immediately contacts Amazon, and is informed that although the CD labels do not match up with the episode numbers, the episodes are merely shuffled and no single episode is missing from the set. Wishing to avoid spoilers,
Lim Li is unwilling to play the CDs herself to figure out which episode lies in each CD. Lim Li thus decides to engage the help of her friend, Rar the Cat. The procedure she will follow is as follows:
This procedure can be done a maximum of Q times, before Rar gets annoyed and stops helping her. Help Lim Li figure out the episode numbers in each CD with minimal help from Rar.
This is an interactive task. Do not read from standard input or write to standard output.
You are to implement the following function:
vector<int> solve(int N, int B, int K, int Q, int ST)
The solve
function will be called exactly once.
You are allowed to call the following grader functions to complete the task:
vector<int> shuffle(vector<int> boxes)
The function shuffle
is called with a 2-dimensional array boxes
, describing the grouping of the N CDs into B boxes
by Lim Li. boxes is to be formatted such that it contains B 1- dimensional arrays, each of which contains K integers representing the labels of the CDs in the box. If your program calls this function more than Q times or with invalid parameters, the program will terminate immediately and you will be given a Wrong Answer verdict.
The array passed to the function shuffle
will not be modified. In other words, you can expect the 2D array boxes
to remain the same after calling the function shuffle
.
The function shuffle
will return a 2-dimensional array, describing the information as given by Rar. The 2-dimensional array consists of B 1-dimensional arrays, each contains K integers describing the episode numbers of the CDs in the box.
Suppose N = 6, B = 3, K = 2, Q = 100, and the testcase belongs to Subtask 2. The episodes are [3, 1, 4, 5, 2, 6]. Your function will be called with the following parameters:
solve(6, 3, 2, 100, 2)
A possible interaction could be as follows:
shuffle([[1, 2], [3, 4], [5, 6]]) = [[6, 2], [5, 4], [3, 1]]
shuffle([[2, 6], [3, 1], [5, 4]]) = [[6, 1], [2, 5], [4, 3]]
shuffle([[6, 5], [4, 2], [3, 1]]) = [[5, 1], [3, 4], [2, 6]]
At this point, your program decides that it has enough information and concludes that the episodes are [3, 4, 1, 5, 2, 6]. As such, your program will return [3, 4, 1, 5, 2, 6]. As the episodes are correct, and the program has used less than 100 queries, it would be deemed as correct for this testcase.
C++17, C++14, C++20, C++14 (Clang), C++17 (Clang), C++20 (Clang)