USACO 2019 January Contest Silver Problem 1 Grass Planting
It's the time of year for Farmer John to plant grass in all of his fields. The entire farm consists of?NN?fields (1≤N≤1051≤N≤105), conveniently numbered?1…N1…N?and conveniently connected by?N?1N?1?...