結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-09-16 21:41:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 1,202 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 105,452 KB
最終ジャッジ日時 2023-08-23 14:42:27
合計ジャッジ時間 7,906 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,316 KB
testcase_01 AC 71 ms
71,320 KB
testcase_02 AC 71 ms
71,460 KB
testcase_03 AC 70 ms
70,992 KB
testcase_04 AC 68 ms
70,996 KB
testcase_05 AC 221 ms
105,256 KB
testcase_06 AC 203 ms
105,304 KB
testcase_07 AC 70 ms
71,404 KB
testcase_08 AC 155 ms
94,712 KB
testcase_09 AC 172 ms
98,836 KB
testcase_10 AC 203 ms
105,248 KB
testcase_11 AC 200 ms
105,452 KB
testcase_12 AC 68 ms
71,484 KB
testcase_13 AC 82 ms
76,912 KB
testcase_14 AC 182 ms
101,084 KB
testcase_15 AC 111 ms
84,656 KB
testcase_16 AC 200 ms
105,388 KB
testcase_17 AC 69 ms
71,468 KB
testcase_18 AC 84 ms
76,876 KB
testcase_19 AC 196 ms
104,272 KB
testcase_20 AC 166 ms
94,728 KB
testcase_21 AC 149 ms
93,796 KB
testcase_22 AC 200 ms
105,356 KB
testcase_23 AC 70 ms
71,320 KB
testcase_24 AC 76 ms
75,980 KB
testcase_25 AC 156 ms
95,564 KB
testcase_26 AC 208 ms
105,264 KB
testcase_27 AC 71 ms
71,512 KB
testcase_28 AC 179 ms
100,108 KB
testcase_29 AC 114 ms
83,776 KB
testcase_30 AC 159 ms
95,104 KB
testcase_31 AC 120 ms
85,500 KB
testcase_32 AC 88 ms
77,008 KB
testcase_33 AC 94 ms
77,676 KB
testcase_34 AC 90 ms
77,248 KB
testcase_35 AC 143 ms
91,232 KB
testcase_36 AC 102 ms
82,020 KB
testcase_37 AC 140 ms
90,572 KB
testcase_38 AC 93 ms
77,480 KB
testcase_39 AC 147 ms
92,652 KB
testcase_40 AC 140 ms
90,648 KB
testcase_41 AC 145 ms
92,600 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