Time limit per test
2 seconds
Memory limit per test
256 megabytes
Input
Standard Input
Output
Standard output
Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an arrayNIntegersA1, bytes,A2, middle..., middle ,...,ANIn
The non-decreasing order. The pseudo code of the program, written by Valera, is given below. The input of the program gets numberNAnd ArrayA.
loop integer variable i from 1 to n - 1 loop integer variable j from i to n - 1 if (aj > aj + 1), then swap the values of elements aj and aj + 1
But Valera coshould have made a mistake, because he hasn't yet fully learned the sorting algorithm. if Valera made a mistake in his program, you need to give a counter-example that makes his program work improperly (that is, the example that makes the program
Sort the array not in the non-decreasing order). If such example for the given valueNDoesn' t exist, print-1.
Input
You 've got a single integerN(1 digit ≤ DigitNLimit ≤ limit 50 )-
The size of the sorted array.
Output
PrintNSpace-separated IntegersA1, bytes,A2, middle..., middle ,...,AN(1 digit ≤ DigitAILimit ≤0000100)
-The counter-example, for which Valera's algorithm won't work correctly. If the counter-example that meets the described conditions is impossible to give, print-1.
If there are several counter-examples, consistingNNumbers, you are allowed to print any of them.
Sample test (s) Input
1
Output
-1
Solution Description: This question is easy to see that it is not an authentic Bubble sorting. I is not used in the inner loop. It can be verified by constructing a sequence from large to small. It can be correctly sorted only when n is 1 or 2.
#include <iostream>#include<cstdio>#include<cstring>#include<cmath>using namespace std;int main(){int n;scanf("%d",&n);if(n==1||n==2){printf("-1\n");}else{for(int i=n;i>=1;i--){printf("%d ",i);}printf("\n");}return 0;}