UVA10647 Optimal House Placement

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=18&page=show_problem&problem=1588 [PDF](https://uva.onlinejudge.org/external/106/p10647.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10647/c044773b3d35a4bc8b8ab0679fd375afc5c1e892.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10647/b3ac92cc6a34901a6199e3e3bae5fe5e0b747a52.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10647/da17e04f65b1a7d9c97ce974dd7247992c7c4823.png)