Fast Travel Coloring
Time limit2sMemory limit256 MB
Color the edges of a complete graph with 7n vertices using n colors so that every vertex pair is joined by an edge of each color or by a two-edge path of that color.
- Level
Hard9 of 10
- Topics
- Graph, Math, Implementation
- Solved
- No attempts yet
Problem
You are given a complete undirected graph with vertices, where is a positive integer. Paint its edges in colors so that for each pair of vertices and each color , at least one of the following holds:
- The edge between and has color .
- There is a vertex such that both edges and have color .
Input
The only line of input contains a positive integer ().
Output
Number the colors from 1 to . Let be if , and the color of the edge otherwise (so ). Print in lines of numbers each.
A solution is guaranteed to exist.
Hint
The second sample corresponds to the following coloring. The two images below show the subgraph for each color.


