結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,524 KB
testcase_01 AC 87 ms
71,760 KB
testcase_02 AC 87 ms
71,312 KB
testcase_03 AC 86 ms
71,676 KB
testcase_04 AC 87 ms
71,576 KB
testcase_05 AC 155 ms
106,708 KB
testcase_06 AC 157 ms
106,720 KB
testcase_07 AC 88 ms
71,508 KB
testcase_08 AC 133 ms
95,132 KB
testcase_09 AC 140 ms
99,908 KB
testcase_10 AC 154 ms
106,780 KB
testcase_11 AC 157 ms
106,744 KB
testcase_12 AC 87 ms
71,452 KB
testcase_13 AC 96 ms
78,256 KB
testcase_14 AC 144 ms
102,336 KB
testcase_15 AC 106 ms
80,264 KB
testcase_16 AC 149 ms
106,756 KB
testcase_17 AC 84 ms
71,496 KB
testcase_18 AC 98 ms
78,308 KB
testcase_19 AC 152 ms
105,828 KB
testcase_20 AC 137 ms
98,004 KB
testcase_21 AC 132 ms
94,556 KB
testcase_22 AC 154 ms
106,480 KB
testcase_23 AC 87 ms
71,508 KB
testcase_24 AC 95 ms
77,516 KB
testcase_25 AC 133 ms
96,200 KB
testcase_26 AC 149 ms
106,888 KB
testcase_27 AC 89 ms
71,656 KB
testcase_28 AC 141 ms
101,124 KB
testcase_29 AC 103 ms
79,564 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 -
権限があれば一括ダウンロードができます

ソースコード

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'])
if a > 0 and b > 0 and c > 0:
    ans = min(a+b+c,N-2)
elif a > 0 and b > 0:
    ans = min(a+b,N-1)
elif a > 0 and c > 0:
    ans = min(a+c,N-1)
elif b > 0 and c > 0:
    ans =min(b+c,N-2)
elif a:
    ans = a
elif b:
    ans = min(b,N-1)
elif c:
    ans= min(c,N-1)
else:
    ans = 0
print(ans)
0