結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー sapphire__15sapphire__15
提出日時 2022-08-25 14:35:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 526 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 30,952 KB
最終ジャッジ日時 2023-08-23 14:07:25
合計ジャッジ時間 11,366 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
29,580 KB
testcase_01 AC 136 ms
29,464 KB
testcase_02 AC 137 ms
29,572 KB
testcase_03 AC 135 ms
29,384 KB
testcase_04 AC 133 ms
29,512 KB
testcase_05 AC 228 ms
30,612 KB
testcase_06 AC 230 ms
30,716 KB
testcase_07 AC 135 ms
29,540 KB
testcase_08 AC 194 ms
30,024 KB
testcase_09 AC 213 ms
30,952 KB
testcase_10 AC 230 ms
30,640 KB
testcase_11 AC 232 ms
30,788 KB
testcase_12 AC 137 ms
29,520 KB
testcase_13 AC 144 ms
29,576 KB
testcase_14 AC 221 ms
30,204 KB
testcase_15 AC 163 ms
29,820 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 231 ms
30,592 KB
testcase_23 AC 136 ms
29,544 KB
testcase_24 AC 139 ms
29,652 KB
testcase_25 AC 198 ms
30,028 KB
testcase_26 AC 232 ms
30,800 KB
testcase_27 AC 136 ms
29,468 KB
testcase_28 AC 213 ms
30,192 KB
testcase_29 AC 161 ms
29,960 KB
testcase_30 AC 200 ms
30,544 KB
testcase_31 AC 168 ms
29,776 KB
testcase_32 AC 151 ms
29,788 KB
testcase_33 AC 154 ms
29,820 KB
testcase_34 AC 151 ms
29,800 KB
testcase_35 AC 186 ms
30,120 KB
testcase_36 AC 156 ms
29,832 KB
testcase_37 AC 184 ms
30,168 KB
testcase_38 AC 151 ms
29,724 KB
testcase_39 AC 189 ms
30,220 KB
testcase_40 AC 181 ms
30,172 KB
testcase_41 AC 188 ms
30,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from functools import reduce
from numpy import roll


def main():
    N = int(input())
    S = input()
    CON = "con"

    buff = [defaultdict(lambda: 0) for _ in range(3)]

    for i, j in enumerate(S):
        buff[i%3][j] += 1
    
    cnt = [reduce(min,
                  map(lambda x, y: x[y],
                      roll(buff, i), CON))
           for i in range(3)]

    if cnt == N:
        print(N)
    else:
        print(min(sum(cnt), N-1))

if __name__ == '__main__':
    main()
0