ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 2174. Dualism of Numbers

Hint
Posted by __Andrewy__ 29 Jul 2025 22:32
Hint 1:
The original graph is not bipartite.
However, you may notice that even numbers are included in one set, and odd numbers > 1 are included in another. Separately, you need to understand what to do with 1.

Hint 2:
Kuhn's Algorithm for Maximum Bipartite Matching for bipartite graph (even numbers, odd numbers > 1 and ones)

Some tests:

10
2 4 6 8 5 7 1 1 9 2
->
YES
2 5
4 7
8 9
6 1
2 1

6
2 4 6 8 1 5
->
NO

12
1 1 1 1 1 2 3 4 5 6 7 8
->
YES
8 3
2 5
6 7
4 1
1 1
1 1

Edited by author 29.07.2025 22:35