codechef | Something About Anything
Here is an example problem to test out the faster input and also solve a problem on codechef ;)
Link to the problem : http://www.codechef.com/problems/PERMUT2
Given a list of integers, the permutation is different possible arrangement of items in the list. Here we are given a single series and the elements of this series act as positions for elements starting from 1 to n and form another series (called as inverse permutation in the problem). Now if the newly formed series and the old series have the same elements starting from 1 to n then they are said to be ambiguous. Our task is to print whether the given series is ambiguous or not.
Let's take an array P of size n (P[n]) and read the list. Create another array Q[n]. We need the values from P[n] which will act as positions for new array Q[n] and the inputs will be starting from 1 to n.
Read full article from codechef | Something About Anything
No comments:
Post a Comment