- 35
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
Given an n-dimensional topology space and a partial order definition, you'll need to sort a set of vectors in that topology space.The topology space does not have a fixed number of dimensions, so you'll have to implement dimensions dynamically.
The ordering relation we will use is ascending order for each coordinate of each vector, following a permutation of coordinates given as input.
For instance, in a 3D space, with
Input
Line 1: An integer D for the number of dimensions
Line 2: An integer N for the number of vectors to sort
Line 3: D space separated integers representing the coordinate permutation to apply for the ordering.
Next N lines: D space separated integers representing the coordinate of a vector in this space.
Line 2: An integer N for the number of vectors to sort
Line 3: D space separated integers representing the coordinate permutation to apply for the ordering.
Next N lines: D space separated integers representing the coordinate of a vector in this space.
Output
A single line containing N space separated integers representing the indexes of the input vectors, ordered by the given permuted ordering relation (ascending).
Indexation of vectors begins at 1 (input line 4).
Indexation of vectors begins at 1 (input line 4).
Constraints
1 ≤ D ≤ 128
1≤ N ≤ 64
There are no duplicates in the input vectors
1≤ N ≤ 64
There are no duplicates in the input vectors
Example
Input
2 2 2 1 0 1 1 0
Output
2 1
A higher resolution is required to access the IDE