TopCoder

User's AC Ratio

100.0% (1/1)

Submission's AC Ratio

100.0% (1/1)

Tags

Description

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

請只排序第 l 個元素到第 r 個元素之間的數字,排序方式為由小到大。區間外的元素位置不變。

這題的目標是練習 bubble sort;只要最後區間內的結果是由小到大排序即可。

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

Input Format

第一行有一個整數 n

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

第三行有兩個整數 l r

Output Format

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

Sample Input 1

6
5 1 4 2 8 3
2 5

Sample Output 1

5 1 2 4 8 3

Hints

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

Problem Source

tioj/problem/list-bubble-sort

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