TopCoder

User's AC Ratio

100.0% (1/1)

Submission's AC Ratio

50.0% (1/2)

Tags

Description

給定一個整數 list,以及兩個位置 l r

請把第 l 個元素到第 r 個元素之間的順序反轉,並輸出最後的 list。

所有位置都是 1-based。保證 1 <= l <= r <= n

Input Format

第一行有一個整數 n

第二行有 n 個整數,表示初始 list。

第三行有兩個整數 l r

Output Format

輸出反轉指定區間後的 list,元素之間用一個空白分隔。

Sample Input 1

5
1 2 3 4 5
2 4

Sample Output 1

1 4 3 2 5

Hints

  • 1 <= n <= 2000
  • list 中的值皆為 32-bit signed integer。

Problem Source

tioj/problem/list-reverse

Subtasks

No. Testdata Range Constraints Score
1 0~3 All testdata 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536 1
1 1000 65536 65536 1
2 1000 65536 65536 1
3 1000 65536 65536 1