#CCBCHBAHAI0000079. Tách mảng thành mảng chẵn và mảng lẻ (Split an Array into Even and Odd Arrays)
Tách mảng thành mảng chẵn và mảng lẻ (Split an Array into Even and Odd Arrays)
Split an Array into Even and Odd Arrays
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given , create two arrays in original order: contains all even values (), and contains all odd values. Their logical sizes are and with .
Input
The first line contains . The second line contains integers .
Output
Line 1 prints followed by all elements of . Line 2 prints followed by all elements of . An empty group is printed as just 0.
Subtask
Subtask 1 (20 points): , .
Subtask 2 (30 points): , .
Subtask 3 (50 points): , .
Example
Input
7
4 -3 0 9 8 -6 5
Output
4 4 0 8 -6
3 -3 9 5
Explanation
The output follows directly from the mathematical definition above.