#P13974. [VKOSHP 2024] Petya's Cryptography
[VKOSHP 2024] Petya's Cryptography
题目描述
Petya received a failing grade in cryptography, but it was the teachers who did not understand his genius, not him being lazy. To convince the entire world community of his genius, Petya created a new public key encryption system --- . Any self-respecting public key cryptosystem has a public key and a private key.
As a private key, Petya chose a tree , and as a public key --- two numbers , where is the number of vertices in the tree , and is the number of paths of length 2 in . Recall that a tree is an undirected connected graph that does not contain cycles.
The peculiarity of Petya's cryptosystem is that any private key corresponding to the public key will suffice to break it. But that's not a problem; Petya chose quite a complex task, right? Restore any private key of the cryptosystem or state that such a public key could not have been produced.
输入格式
The input consists of a single line containing two numbers and (, ).
输出格式
If a solution exists, output in the first line. In the next lines, output two distinct integers from 1 to --- the edges of the tree.
If no solution exists, output in a single line.
7 11
Yes
1 2
2 3
3 4
3 5
3 6
3 7
5 5
No