結果
問題 | No.2073 Concon Substrings (Swap Version) |
ユーザー |
![]() |
提出日時 | 2025-05-14 12:49:38 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 560 bytes |
コンパイル時間 | 255 ms |
コンパイル使用メモリ | 82,788 KB |
実行使用メモリ | 77,372 KB |
最終ジャッジ日時 | 2025-05-14 12:51:05 |
合計ジャッジ時間 | 3,784 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 25 WA * 12 |
ソースコード
n = int(input()) s = input().strip() from collections import defaultdict groups = [defaultdict(int) for _ in range(3)] for i in range(len(s)): g = i % 3 c = s[i] groups[g][c] += 1 c0 = groups[0].get('c', 0) o0 = groups[0].get('o', 0) n0 = groups[0].get('n', 0) o1 = groups[1].get('o', 0) n2 = groups[2].get('n', 0) c1 = groups[1].get('c', 0) o2 = groups[2].get('o', 0) c2 = groups[2].get('c', 0) n1 = groups[1].get('n', 0) term0 = min(c0, o1, n2, n) term1 = min(c1, o2, n0, n - 1) term2 = min(c2, o0, n1, n - 1) print(term0 + term1 + term2)