結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー rlangevinrlangevin
提出日時 2023-01-27 23:07:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 749 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 107,184 KB
最終ジャッジ日時 2023-09-10 16:53:29
合計ジャッジ時間 9,261 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,632 KB
testcase_01 AC 91 ms
71,708 KB
testcase_02 AC 92 ms
71,612 KB
testcase_03 AC 92 ms
71,556 KB
testcase_04 AC 93 ms
71,468 KB
testcase_05 AC 164 ms
106,784 KB
testcase_06 AC 163 ms
106,912 KB
testcase_07 AC 91 ms
71,744 KB
testcase_08 AC 136 ms
95,748 KB
testcase_09 AC 145 ms
100,144 KB
testcase_10 AC 156 ms
107,064 KB
testcase_11 AC 160 ms
106,724 KB
testcase_12 AC 91 ms
71,656 KB
testcase_13 AC 103 ms
78,688 KB
testcase_14 AC 149 ms
102,696 KB
testcase_15 AC 108 ms
80,412 KB
testcase_16 AC 154 ms
106,780 KB
testcase_17 AC 91 ms
71,588 KB
testcase_18 AC 101 ms
78,608 KB
testcase_19 AC 154 ms
105,928 KB
testcase_20 AC 139 ms
98,360 KB
testcase_21 AC 133 ms
94,876 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 AC 135 ms
96,664 KB
testcase_31 AC 111 ms
80,412 KB
testcase_32 AC 102 ms
78,908 KB
testcase_33 AC 103 ms
79,148 KB
testcase_34 AC 108 ms
78,988 KB
testcase_35 AC 127 ms
92,116 KB
testcase_36 AC 105 ms
79,256 KB
testcase_37 AC 127 ms
91,208 KB
testcase_38 AC 102 ms
78,908 KB
testcase_39 AC 131 ms
93,492 KB
testcase_40 AC 127 ms
91,492 KB
testcase_41 AC 132 ms
93,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

N = int(input())
S = list(input())
D = [defaultdict(int) for i in range(3)]
for i in range(3*N):
    D[i%3][S[i]] += 1

L = [0, 0, 0]
L[0] = min(D[0]["c"], D[1]["o"], D[2]["n"])
L[1] = min(D[0]["n"], D[1]["c"], D[2]["o"])
L[2] = min(D[0]["o"], D[1]["n"], D[2]["c"])

# print(L)
# print(D)
ans = 0
N *= 3
if N >= 3 * L[0]:
    ans += L[0]
    if L[0]:
        N -= 3 * L[0] + 1
        N = max(0, N)
else:
    print(ans + N//3)
    exit()
if N >= 3 * L[1]:
    ans += L[1]
    if L[1]:
        N -= 3 * L[1] + 1
        N = max(0, N)
else:
    print(ans + N//3)
    exit()
    
if N >= 3 * L[2]:
    ans += L[2]
    if L[2]:
        N -= 3 * L[2] + 1
        N = max(0, N)
else:
    print(ans + N//3)
    exit()

print(ans)
0