Submission #2841191


Source Code Expand

Copy
N = gets.to_i
as = gets.split.map(&:to_i)
ans = 0
(N-1).times do |i|
    if as[i] == as[i+1]
        as[i+1] = -1
        ans += 1
    end
end
puts ans

Submission Info

Submission Time
Task A - Colorful Slimes 2
User betrue12
Language Ruby (2.3.3)
Score 200
Code Size 160 Byte
Status
Exec Time 7 ms
Memory 1788 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example_0, example_1, example_2, example_3
All 200 / 200 example_0, example_1, example_2, example_3, handmade_0, handmade_1, rand_0, rand_1, smallcolor_0, smallcolor_1, smallcolor_2, smallcolor_3, smallcolor_4
Case Name Status Exec Time Memory
example_0 7 ms 1788 KB
example_1 7 ms 1788 KB
example_2 7 ms 1788 KB
example_3 7 ms 1788 KB
handmade_0 7 ms 1788 KB
handmade_1 7 ms 1788 KB
rand_0 7 ms 1788 KB
rand_1 7 ms 1788 KB
smallcolor_0 7 ms 1788 KB
smallcolor_1 7 ms 1788 KB
smallcolor_2 7 ms 1788 KB
smallcolor_3 7 ms 1788 KB
smallcolor_4 7 ms 1788 KB