当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
The towns in Bytie's domain are numbered from 1 to N. Next, M lines describing the roads follow. Each of those lines holds two integers, Ai and Bi (1<=Ai,Bi<=N,Ai<>Bi) , indicating that the towns no. Ai and Bi are directly linked by a bidirectional road. Each pair of towns is linked by at most a single road.
If more than one solution exists, any solution can be printed. Let us remind that any placement of no more than K improved towers will do - you need not minimize their number. You may assume that Bytea was correct, i.e., that the whole domain of Bytie can indeed be protected by K plain (not improved) guard towers. Thus a solution always exists.
9 8 3 1 2 2 3 3 4 1 4 3 5 4 6 7 8 8 9
3 1 5 7
2<=n<=500000,0<=m<=1000000
| 时间上限 | 内存上限 |
| 10000 MS | 128 MB |