Блог пользователя AbhayChandna

Автор AbhayChandna, история, 4 года назад, По-английски

https://codeforces.com/contest/1353/problem/E

On input 
6
9 2
010001010
9 3
111100000
7 4
1111111
10 3
1001110101
1 1
1
1 1
0

Output is 
1
2
5
4
0
0

In the second testcase, how is the output 2?

if we swithc all off all lamps, 4 moves if we switch on lamps on index 0 3 6 , moves 3 (switch off {1,2} switch on{6})

if we switch on lamps on index 1 4 7 , moves 4 (switch off {0,2,3} switch on{7})

if we switch on lamps on index 2 5 8 , moves 4 (switch off {0,1,3} switch on{8})

So , how is the minimum required moves 2?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -7
  • Проголосовать: не нравится