#MTH000000024. Tam đẳng cấu (Tri-Isomorphism)
Tam đẳng cấu (Tri-Isomorphism)
Tri-Isomorphism
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
A simple graph has neither loops nor multiple edges. Two graphs are isomorphic if there is a bijection between their vertex sets that preserves adjacency.
denotes the complete graph on vertices, so every pair of distinct vertices is connected by an edge.
A decomposition of a graph is a list of subgraphs in which every edge of the original graph appears in exactly one subgraph.
Given , determine whether can be decomposed into exactly three pairwise-isomorphic subgraphs.
Input
One positive integer .
Output
Print YES if such a decomposition exists; otherwise print NO.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): and or .
- Subtask 3 (50%): Full constraints: .
Examples
Input
4
Output
YES
Explanation
has edges. They can be partitioned into three edge sets of size whose subgraphs are isomorphic, so the answer is YES.