[BOJ 6173] Pearl Pairing
View as PDF
Submit solution
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text
Points:
3
Time limit:
1.0s
Memory limit:
128M
Problem types
Allowed languages
At Bessie's recent birthday party, she received N (2 <= N <= 100,000; N%2 == 0) pearls, each painted one of C different colors (1 <= C <= N).</p>
Upon observing that the number of pearls N is always even, her creative juices flowed and she decided to pair the pearls so that each pair of pearls has two different colors.
Knowing that such a set of pairings is always possible for the supplied testcases, help Bessie perform such a pairing. If there are multiple ways of creating a pairing, any solution suffices.
입력 형식
- Line 1: Two space-separated integers: N and C
- Lines 2..C + 1: Line i+1 tells the count of pearls with color i: C_i </ul>
- Lines 1..N/2: Line i contains two integers a_i and b_i indicating that Bessie can pair two pearls with respective colors a_i and b_i.
## 출력 형식
예제 입력
8 3
2
2
4
예제 출력
1 3
1 3
2 3
3 2
힌트
Bessie pairs each pearl of color III with one of color I and II.
Comments