HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Forums > Discussion of problems > topic:


Problem "50488 - Connecting Wires"

There is a contest!

В настоящий момент идёт турнир. Некоторая информация и функции сервера недоступны до его окончания.

imesecanSep.15.2015 at 09:31:05 AM
0-- Test 1 ---
7
Black
White
Black
Black
Black
White
White
White
Black
White
Black
White
Black
White

--- Pattern ---
13

imesecanMar.04.2016 at 10:16:06 AM
1Prepare two arrays black and white
Then put the positions of blacks into black array and positions of whites into white array. Here is how sample 1 is processed.
Black White
0 2
1 4
3 5
7 6

Then calculate the sum of absolute differences of the first balck and first white, etc. abs(0-2) + abs(1-3) + abs(3-5) + abs(7-6) = 8


www.contester.ru