結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー simansiman
提出日時 2022-09-21 01:06:26
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 11,480 KB
実行使用メモリ 16,668 KB
最終ジャッジ日時 2023-08-23 19:45:50
合計ジャッジ時間 10,772 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,188 KB
testcase_01 AC 82 ms
15,016 KB
testcase_02 AC 82 ms
15,236 KB
testcase_03 AC 82 ms
15,116 KB
testcase_04 AC 81 ms
15,052 KB
testcase_05 AC 319 ms
16,456 KB
testcase_06 AC 316 ms
16,588 KB
testcase_07 AC 83 ms
15,276 KB
testcase_08 AC 231 ms
15,960 KB
testcase_09 AC 264 ms
16,144 KB
testcase_10 AC 313 ms
16,660 KB
testcase_11 AC 311 ms
16,652 KB
testcase_12 AC 82 ms
15,236 KB
testcase_13 AC 105 ms
15,268 KB
testcase_14 AC 278 ms
16,400 KB
testcase_15 AC 150 ms
15,768 KB
testcase_16 AC 300 ms
16,668 KB
testcase_17 AC 83 ms
15,132 KB
testcase_18 AC 105 ms
15,292 KB
testcase_19 AC 289 ms
16,336 KB
testcase_20 AC 238 ms
16,200 KB
testcase_21 AC 213 ms
16,104 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
S = gets.chomp
L = S.size

counter = Array.new(3) { Hash.new(0) }

L.times do |i|
  s = S[i]

  counter[i % 3][s] += 1
end

ans = 0
ans += [counter[0]['c'], counter[1]['o'], counter[2]['n']].min
ans += [counter[1]['c'], counter[2]['o'], counter[0]['n']].min
ans += [counter[2]['c'], counter[0]['o'], counter[1]['n']].min

puts ans
0