#P5271. OwenOwl 不学车也不删库
OwenOwl 不学车也不删库
Description
Let be a prime number.
You are given an undirected complete graph with vertices (there is an undirected edge between any two vertices). The vertices are labeled from to .
Now you need to find some complete subgraphs on vertices such that every edge in the original graph belongs to one and only one of these complete subgraphs.
Obviously, the number of complete subgraphs you need to find is . You can see that this expression is always an integer.
Input Format
One line containing two positive integers .
Output Format
If there is no solution, output one line NO.
Otherwise, output one line YES, then output lines. Each line contains numbers, representing the vertex labels of one complete subgraph you found.
You may output any valid solution in any order.
2 2
YES
0 1
2 0
3 0
1 2
1 3
3 2
3 1
YES
0 1 2
Hint
For of the testdata, .
For of the testdata, .
Another of the testdata has .
For of the testdata, is a positive integer, is prime, and .
In addition, the total output size is guaranteed not to exceed 2MB, but you should still pay attention to the time spent on output.
Translated by ChatGPT 5
京公网安备 11011102002149号