結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー lilictakalilictaka
提出日時 2022-09-18 23:12:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 86,428 KB
実行使用メモリ 106,632 KB
最終ジャッジ日時 2023-08-23 18:24:17
合計ジャッジ時間 8,623 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,228 KB
testcase_01 AC 87 ms
71,336 KB
testcase_02 AC 89 ms
71,128 KB
testcase_03 AC 90 ms
71,356 KB
testcase_04 AC 89 ms
71,504 KB
testcase_05 AC 166 ms
106,540 KB
testcase_06 AC 159 ms
106,468 KB
testcase_07 AC 89 ms
71,460 KB
testcase_08 AC 137 ms
95,008 KB
testcase_09 AC 143 ms
99,704 KB
testcase_10 AC 157 ms
106,408 KB
testcase_11 AC 158 ms
106,412 KB
testcase_12 AC 89 ms
71,164 KB
testcase_13 AC 98 ms
78,224 KB
testcase_14 AC 147 ms
102,252 KB
testcase_15 AC 106 ms
79,840 KB
testcase_16 AC 154 ms
106,504 KB
testcase_17 AC 89 ms
71,512 KB
testcase_18 AC 99 ms
78,232 KB
testcase_19 AC 151 ms
105,412 KB
testcase_20 AC 142 ms
97,540 KB
testcase_21 AC 131 ms
94,172 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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N = int(input())
S = list(input())
cnt = [defaultdict(int) for _ in range(3)]
for i,s in enumerate(S):
    cnt[i%3][s] +=1
a = min(cnt[0]['c'],cnt[1]['o'],cnt[2]['n'])
b = min(cnt[0]['o'],cnt[1]['n'],cnt[2]['c'])
c = min(cnt[0]['n'],cnt[1]['c'],cnt[2]['o'])
tmp = 0
if a >0:
    tmp +=1
if b > 0:
    tmp +=1
if c > 0:
    tmp =+1
if tmp==3:
    ans = min(a+b+c,N-2)
elif tmp ==2:
    ans = min(a+b+c,N-1)
elif tmp == 1:
    ans = min(a+b+c,N)
else:
    ans = 0
print(ans)
0