The Dutch Flag Problem

Provided values

The colors are represented through the following constants: BLUE, WHITE and RED. You can use them directly in your code.

Provided functions

This world is very simple, with only 5 provided functions.

[!java|c]void [/!]swap([!java|c]int [/!]x[!scala]:Int[/!], [!java|c]int [/!]y[!scala]:Int[/!])
Swap the lines number x and y.
[!java|c]int [/!]getSize() [!scala]:Int[/!]
Returns the amount of lines on this flag.
[!java|c]int [/!]getColor([!java|c]int [/!]line[!scala]:Int[/!])  [!scala]:Int[/!]
Returns the color of the given line.
[!java]boolean [/!][!c]int [/!]isSorted()  [!scala]:Boolean[/!]
Returns whether the flag is sorted.
[!java]boolean [/!][!c]int [/!]isSelected()  [!scala]:Boolean[/!]
Returns whether the current world is selected in the interface.