結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー rin204rin204
提出日時 2022-09-16 21:32:43
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 280 ms
使用メモリ 82,428 KB
最終ジャッジ日時 2023-01-11 06:03:11
合計ジャッジ時間 6,367 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 77 ms
75,704 KB
testcase_01 AC 77 ms
75,772 KB
testcase_02 AC 77 ms
75,844 KB
testcase_03 AC 76 ms
75,868 KB
testcase_04 AC 76 ms
75,756 KB
testcase_05 AC 97 ms
82,276 KB
testcase_06 AC 100 ms
81,960 KB
testcase_07 AC 75 ms
75,712 KB
testcase_08 AC 92 ms
81,972 KB
testcase_09 AC 95 ms
81,692 KB
testcase_10 AC 108 ms
81,868 KB
testcase_11 AC 111 ms
82,196 KB
testcase_12 AC 76 ms
75,652 KB
testcase_13 AC 89 ms
80,608 KB
testcase_14 AC 105 ms
81,596 KB
testcase_15 AC 96 ms
81,344 KB
testcase_16 AC 101 ms
82,428 KB
testcase_17 AC 76 ms
75,500 KB
testcase_18 AC 86 ms
80,616 KB
testcase_19 AC 99 ms
82,256 KB
testcase_20 AC 95 ms
81,412 KB
testcase_21 AC 95 ms
81,804 KB
testcase_22 AC 101 ms
81,852 KB
testcase_23 AC 76 ms
75,500 KB
testcase_24 AC 83 ms
80,352 KB
testcase_25 AC 93 ms
81,968 KB
testcase_26 AC 99 ms
82,188 KB
testcase_27 AC 76 ms
75,796 KB
testcase_28 AC 98 ms
81,820 KB
testcase_29 AC 86 ms
80,668 KB
testcase_30 AC 96 ms
81,884 KB
testcase_31 AC 90 ms
80,816 KB
testcase_32 AC 86 ms
80,748 KB
testcase_33 AC 89 ms
80,836 KB
testcase_34 AC 91 ms
80,388 KB
testcase_35 AC 96 ms
81,640 KB
testcase_36 AC 89 ms
80,408 KB
testcase_37 AC 96 ms
81,684 KB
testcase_38 AC 90 ms
80,876 KB
testcase_39 AC 97 ms
81,940 KB
testcase_40 AC 95 ms
81,804 KB
testcase_41 AC 95 ms
82,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
S = input()
cnt = [[0] * 3 for _ in range(3)]
for i, s in enumerate(S):
    if s == "c":
        cnt[i % 3][0] += 1
    elif s == "o":
        cnt[i % 3][1] += 1
    elif s == "n":
        cnt[i % 3][2] += 1


ans = 0
lst = []
for i in range(3):
    mi = 1 << 30
    for j in range(3):
        mi = min(mi, cnt[(i + j) % 3][j])
    lst.append(mi)
    ans += mi
if ans == n and n != lst[0]:
    ans -= 1
print(ans)
0