結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー kyskys
提出日時 2022-09-16 22:09:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 1,068 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 77,932 KB
最終ジャッジ日時 2023-08-23 15:45:55
合計ジャッジ時間 5,589 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,164 KB
testcase_01 AC 71 ms
71,348 KB
testcase_02 AC 70 ms
71,268 KB
testcase_03 AC 69 ms
71,060 KB
testcase_04 AC 69 ms
71,224 KB
testcase_05 AC 115 ms
77,832 KB
testcase_06 AC 96 ms
77,932 KB
testcase_07 AC 71 ms
71,180 KB
testcase_08 AC 84 ms
77,304 KB
testcase_09 AC 86 ms
77,300 KB
testcase_10 AC 96 ms
77,396 KB
testcase_11 AC 95 ms
77,872 KB
testcase_12 AC 69 ms
71,316 KB
testcase_13 AC 79 ms
76,152 KB
testcase_14 AC 94 ms
77,500 KB
testcase_15 AC 85 ms
76,788 KB
testcase_16 AC 89 ms
77,508 KB
testcase_17 AC 72 ms
71,008 KB
testcase_18 AC 75 ms
76,024 KB
testcase_19 AC 85 ms
77,556 KB
testcase_20 AC 84 ms
76,956 KB
testcase_21 AC 80 ms
76,756 KB
testcase_22 AC 85 ms
77,468 KB
testcase_23 AC 69 ms
71,464 KB
testcase_24 AC 74 ms
75,820 KB
testcase_25 AC 81 ms
76,604 KB
testcase_26 AC 87 ms
77,368 KB
testcase_27 AC 69 ms
71,240 KB
testcase_28 AC 86 ms
77,116 KB
testcase_29 AC 80 ms
76,036 KB
testcase_30 AC 84 ms
77,264 KB
testcase_31 AC 78 ms
76,284 KB
testcase_32 AC 77 ms
76,036 KB
testcase_33 AC 76 ms
75,824 KB
testcase_34 AC 78 ms
75,976 KB
testcase_35 AC 78 ms
76,660 KB
testcase_36 AC 76 ms
75,836 KB
testcase_37 AC 81 ms
76,396 KB
testcase_38 AC 77 ms
76,024 KB
testcase_39 AC 79 ms
76,676 KB
testcase_40 AC 80 ms
76,644 KB
testcase_41 AC 81 ms
76,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    from sys import stdin, setrecursionlimit
    # setrecursionlimit(1000000)
    input = stdin.readline
    def iinput(): return int(input())
    def sinput(): return input().rstrip()
    def i0input(): return int(input()) - 1
    def linput(): return list(input().split())
    def liinput(): return list(map(int, input().split()))
    def miinput(): return map(int, input().split())
    def li0input(): return list(map(lambda x: int(x) - 1, input().split()))
    def mi0input(): return map(lambda x: int(x) - 1, input().split())
    INF = 1000000000000000000
    MOD = 1000000007

    N = iinput()
    S = sinput()

    ans = [[0] * 3 for _ in [0] * 3]
    con = 'con'
    for i in range(N * 3):
        c = S[i]
        try:
            j = con.index(c)
        except ValueError:
            continue
        ans[(i-j)%3][j%3] += 1
    ans = [min(ans[i]) for i in range(3)]
    # ans.sort(reverse=True)
    if sum(ans) <= N - 1:
        print(sum(ans))
    else:
        if ans[0] == N:
            print(N)
        else:
            print(N-1)

main()
0