結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー sapphire__15sapphire__15
提出日時 2022-08-25 14:35:20
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 526 bytes
コンパイル時間 135 ms
使用メモリ 29,980 KB
最終ジャッジ日時 2023-01-11 05:33:12
合計ジャッジ時間 10,987 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 126 ms
28,540 KB
testcase_01 AC 131 ms
28,544 KB
testcase_02 AC 126 ms
28,396 KB
testcase_03 AC 127 ms
28,488 KB
testcase_04 AC 126 ms
28,544 KB
testcase_05 AC 235 ms
29,836 KB
testcase_06 AC 241 ms
29,980 KB
testcase_07 AC 126 ms
28,504 KB
testcase_08 AC 192 ms
28,964 KB
testcase_09 AC 213 ms
29,252 KB
testcase_10 AC 233 ms
29,756 KB
testcase_11 AC 235 ms
29,820 KB
testcase_12 AC 128 ms
28,460 KB
testcase_13 AC 137 ms
28,720 KB
testcase_14 AC 220 ms
29,332 KB
testcase_15 AC 159 ms
28,696 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 235 ms
29,832 KB
testcase_23 AC 128 ms
28,540 KB
testcase_24 AC 129 ms
28,584 KB
testcase_25 AC 194 ms
29,044 KB
testcase_26 AC 236 ms
29,840 KB
testcase_27 AC 129 ms
28,540 KB
testcase_28 AC 216 ms
29,476 KB
testcase_29 AC 155 ms
28,964 KB
testcase_30 AC 198 ms
29,228 KB
testcase_31 AC 161 ms
28,988 KB
testcase_32 AC 141 ms
28,808 KB
testcase_33 AC 146 ms
28,732 KB
testcase_34 AC 145 ms
28,680 KB
testcase_35 AC 183 ms
29,140 KB
testcase_36 AC 152 ms
28,656 KB
testcase_37 AC 180 ms
28,980 KB
testcase_38 AC 143 ms
28,564 KB
testcase_39 AC 187 ms
28,960 KB
testcase_40 AC 177 ms
29,352 KB
testcase_41 AC 186 ms
29,156 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