Percolation task
Greedy algorythm for weighted process