Hello World

查看题解 查看答案
题目描述
Time Limit: 1000 ms
Memory Limit: 256 mb

请先登录再刷题,不会做的题目右上可以查看题解和答案~

输入输出格式
输入描述:
The first line contains an integer n (1 <= n <= 1000) ——Indicates the number of days planned. The second line contains space-separated n integers which are the spoilt sequence of plans.

 It is guaranteed that the given sequence is a permutation, i.e. it contains only integers from 1 to n, and every number is used exactly 1 time.
输出描述:
If it is impossible to obtain the given permutation from the original one in exactly one action, print 0 0. Otherwise, print two numbers l r (1 <= l <= r <= n)which are the endpoints of the 

segment that needs to be reversed to obtain from permutation 1 2 ... n the given one.
输入输出样例
输入样例#:
7
2 3 4 5 6 7 1
10
1 2 3 7 6 5 4 8 9 10
5
1 2 3 4 5
输出样例#:
复制
0 0
4 7
0 0
重置

提交代码后在此处可查看状态