Solved the problem DCEPC504 of spoj