結果
問題 | No.2073 Concon Substrings (Swap Version) |
ユーザー | dn6049949 |
提出日時 | 2022-09-16 22:27:12 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 997 bytes |
コンパイル時間 | 287 ms |
コンパイル使用メモリ | 87,268 KB |
実行使用メモリ | 78,360 KB |
最終ジャッジ日時 | 2023-08-23 16:04:51 |
合計ジャッジ時間 | 6,819 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 91 ms
71,656 KB |
testcase_01 | AC | 89 ms
71,768 KB |
testcase_02 | AC | 89 ms
71,568 KB |
testcase_03 | AC | 90 ms
71,680 KB |
testcase_04 | AC | 90 ms
71,700 KB |
testcase_05 | AC | 110 ms
78,216 KB |
testcase_06 | AC | 112 ms
78,240 KB |
testcase_07 | AC | 90 ms
71,560 KB |
testcase_08 | AC | 107 ms
77,512 KB |
testcase_09 | AC | 107 ms
77,864 KB |
testcase_10 | AC | 120 ms
78,284 KB |
testcase_11 | AC | 121 ms
78,292 KB |
testcase_12 | AC | 90 ms
71,412 KB |
testcase_13 | AC | 102 ms
76,776 KB |
testcase_14 | AC | 115 ms
77,972 KB |
testcase_15 | AC | 105 ms
77,228 KB |
testcase_16 | AC | 114 ms
78,360 KB |
testcase_17 | AC | 100 ms
71,368 KB |
testcase_18 | AC | 112 ms
76,776 KB |
testcase_19 | AC | 118 ms
78,104 KB |
testcase_20 | AC | 116 ms
77,832 KB |
testcase_21 | AC | 114 ms
77,496 KB |
testcase_22 | AC | 121 ms
78,248 KB |
testcase_23 | AC | 96 ms
71,712 KB |
testcase_24 | AC | 107 ms
76,580 KB |
testcase_25 | AC | 115 ms
77,516 KB |
testcase_26 | AC | 121 ms
78,320 KB |
testcase_27 | AC | 97 ms
71,768 KB |
testcase_28 | AC | 117 ms
77,624 KB |
testcase_29 | AC | 111 ms
76,940 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
ソースコード
from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 def main(): n = I() s = input() count_c = [0]*3 count_o = [0]*3 count_n = [0]*3 for i,si in enumerate(s): if si == "c": count_c[i%3] += 1 elif si == "o": count_o[i%3] += 1 elif si == "n": count_n[i%3] += 1 c = [count_c, count_o, count_n] ans = 0 for i in range(3): m = float("inf") for j in range(3): m = min(m, c[j][(i+j)%3]) if m == n and i != 0: m = n-1 ans += m print(ans) return if __name__ == "__main__": main()