結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー 👑 rin204rin204
提出日時 2022-09-16 21:32:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,280 KB
実行使用メモリ 77,728 KB
最終ジャッジ日時 2023-08-23 14:29:14
合計ジャッジ時間 5,641 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,200 KB
testcase_01 AC 71 ms
71,188 KB
testcase_02 AC 75 ms
71,200 KB
testcase_03 AC 72 ms
71,200 KB
testcase_04 AC 73 ms
71,144 KB
testcase_05 AC 92 ms
77,300 KB
testcase_06 AC 95 ms
77,432 KB
testcase_07 AC 71 ms
71,168 KB
testcase_08 AC 86 ms
77,376 KB
testcase_09 AC 91 ms
76,976 KB
testcase_10 AC 104 ms
77,556 KB
testcase_11 AC 103 ms
77,660 KB
testcase_12 AC 72 ms
71,188 KB
testcase_13 AC 82 ms
75,984 KB
testcase_14 AC 102 ms
77,476 KB
testcase_15 AC 88 ms
76,688 KB
testcase_16 AC 97 ms
77,516 KB
testcase_17 AC 74 ms
71,280 KB
testcase_18 AC 81 ms
75,788 KB
testcase_19 AC 94 ms
77,728 KB
testcase_20 AC 90 ms
76,916 KB
testcase_21 AC 90 ms
76,920 KB
testcase_22 AC 96 ms
77,440 KB
testcase_23 AC 72 ms
71,032 KB
testcase_24 AC 82 ms
76,092 KB
testcase_25 AC 92 ms
77,048 KB
testcase_26 AC 98 ms
77,204 KB
testcase_27 AC 71 ms
70,996 KB
testcase_28 AC 95 ms
77,368 KB
testcase_29 AC 85 ms
75,972 KB
testcase_30 AC 92 ms
77,180 KB
testcase_31 AC 84 ms
76,176 KB
testcase_32 AC 83 ms
75,876 KB
testcase_33 AC 83 ms
75,924 KB
testcase_34 AC 84 ms
75,752 KB
testcase_35 AC 91 ms
76,888 KB
testcase_36 AC 83 ms
75,760 KB
testcase_37 AC 90 ms
76,840 KB
testcase_38 AC 83 ms
76,012 KB
testcase_39 AC 93 ms
77,108 KB
testcase_40 AC 91 ms
76,988 KB
testcase_41 AC 93 ms
77,312 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