結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-09-16 21:41:53
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 419 ms
使用メモリ 110,232 KB
最終ジャッジ日時 2023-01-11 06:20:31
合計ジャッジ時間 8,762 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 70 ms
75,760 KB
testcase_01 AC 70 ms
75,792 KB
testcase_02 AC 69 ms
75,864 KB
testcase_03 AC 70 ms
75,896 KB
testcase_04 AC 69 ms
75,892 KB
testcase_05 AC 237 ms
110,056 KB
testcase_06 AC 231 ms
110,232 KB
testcase_07 AC 70 ms
75,492 KB
testcase_08 AC 175 ms
98,840 KB
testcase_09 AC 199 ms
103,408 KB
testcase_10 AC 231 ms
110,224 KB
testcase_11 AC 237 ms
109,972 KB
testcase_12 AC 69 ms
75,756 KB
testcase_13 AC 88 ms
81,504 KB
testcase_14 AC 212 ms
105,968 KB
testcase_15 AC 122 ms
89,032 KB
testcase_16 AC 227 ms
109,868 KB
testcase_17 AC 70 ms
75,872 KB
testcase_18 AC 87 ms
81,272 KB
testcase_19 AC 223 ms
108,472 KB
testcase_20 AC 183 ms
99,252 KB
testcase_21 AC 166 ms
98,540 KB
testcase_22 AC 230 ms
109,944 KB
testcase_23 AC 70 ms
75,884 KB
testcase_24 AC 78 ms
80,520 KB
testcase_25 AC 176 ms
99,372 KB
testcase_26 AC 230 ms
109,944 KB
testcase_27 AC 71 ms
75,840 KB
testcase_28 AC 204 ms
104,496 KB
testcase_29 AC 115 ms
88,312 KB
testcase_30 AC 179 ms
97,780 KB
testcase_31 AC 127 ms
90,328 KB
testcase_32 AC 95 ms
81,648 KB
testcase_33 AC 107 ms
85,536 KB
testcase_34 AC 95 ms
82,488 KB
testcase_35 AC 156 ms
95,712 KB
testcase_36 AC 106 ms
86,436 KB
testcase_37 AC 151 ms
94,860 KB
testcase_38 AC 96 ms
82,460 KB
testcase_39 AC 163 ms
97,428 KB
testcase_40 AC 151 ms
94,764 KB
testcase_41 AC 162 ms
97,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
s=list(input())
from _collections import defaultdict
cnt=defaultdict(int)
for i in range(3*n):
    cnt[i%3,s[i]]+=1
ans=0
nokori=3*n
for j in range(3):
    res=min(cnt[j,"c"],cnt[(j+1)%3,"o"],cnt[(j+2)%3,"n"])
    while nokori-3*res<0 and res>0:res-=1
    ans+=res
    nokori-=3*res
    nokori-=1

print(ans)

0