Codeforces Round #642 (Div. 3) Problem E — K-periodic Garland (Help in sample testcase)

Правка en2, от AbhayChandna, 2020-05-15 15:54:12

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?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский AbhayChandna 2020-05-15 15:54:12 22
en1 Английский AbhayChandna 2020-05-15 15:52:55 644 Initial revision (published)