結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
![]() |
提出日時 | 2025-06-12 17:04:57 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,029 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 82,568 KB |
実行使用メモリ | 118,836 KB |
最終ジャッジ日時 | 2025-06-12 17:05:03 |
合計ジャッジ時間 | 5,129 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 17 WA * 20 |
ソースコード
def main(): import sys input = sys.stdin.read data = input().split() N = int(data[0]) S = data[1] len_S = 3 * N mod0 = [] mod1 = [] mod2 = [] for i in range(len_S): c = S[i] if i % 3 == 0: mod0.append(c) elif i % 3 == 1: mod1.append(c) else: mod2.append(c) from collections import defaultdict def count_chars(arr): cnt = defaultdict(int) for c in arr: cnt[c] += 1 return cnt cnt0 = count_chars(mod0) cnt1 = count_chars(mod1) cnt2 = count_chars(mod2) c0 = cnt0.get('c', 0) o1 = cnt1.get('o', 0) n2 = cnt2.get('n', 0) case1 = min(c0, o1, n2) c1 = cnt1.get('c', 0) o2 = cnt2.get('o', 0) n0 = cnt0.get('n', 0) case2 = min(c1, o2, n0) c2 = cnt2.get('c', 0) o0 = cnt0.get('o', 0) n1 = cnt1.get('n', 0) case3 = min(c2, o0, n1) total = case1 + case2 + case3 print(total) if __name__ == "__main__": main()