結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー simansiman
提出日時 2022-09-21 01:23:30
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 11,348 KB
実行使用メモリ 16,756 KB
最終ジャッジ日時 2023-08-23 19:46:22
合計ジャッジ時間 9,729 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
15,028 KB
testcase_01 AC 87 ms
15,284 KB
testcase_02 AC 88 ms
15,068 KB
testcase_03 AC 86 ms
15,244 KB
testcase_04 AC 87 ms
15,068 KB
testcase_05 AC 319 ms
16,540 KB
testcase_06 AC 321 ms
16,672 KB
testcase_07 AC 86 ms
15,308 KB
testcase_08 AC 237 ms
16,052 KB
testcase_09 AC 267 ms
16,396 KB
testcase_10 AC 315 ms
16,564 KB
testcase_11 AC 316 ms
16,756 KB
testcase_12 AC 80 ms
15,072 KB
testcase_13 AC 103 ms
15,348 KB
testcase_14 AC 277 ms
16,396 KB
testcase_15 AC 145 ms
15,684 KB
testcase_16 AC 299 ms
16,548 KB
testcase_17 AC 80 ms
15,212 KB
testcase_18 AC 102 ms
15,244 KB
testcase_19 AC 288 ms
16,448 KB
testcase_20 AC 232 ms
15,972 KB
testcase_21 AC 208 ms
15,852 KB
testcase_22 AC 296 ms
16,676 KB
testcase_23 AC 80 ms
15,088 KB
testcase_24 AC 85 ms
15,240 KB
testcase_25 AC 219 ms
16,012 KB
testcase_26 AC 300 ms
16,544 KB
testcase_27 AC 82 ms
15,012 KB
testcase_28 AC 261 ms
16,392 KB
testcase_29 AC 139 ms
15,676 KB
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 += [[N - 1, counter[1]['c']].min, counter[2]['o'], counter[0]['n']].min
ans += [[N - 1, counter[2]['c']].min, [N - 1, counter[0]['o']].min, counter[1]['n']].min

puts ans
0