結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
![]() |
提出日時 | 2025-06-12 17:04:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 774 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 82,532 KB |
実行使用メモリ | 111,356 KB |
最終ジャッジ日時 | 2025-06-12 17:04:38 |
合計ジャッジ時間 | 4,268 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 17 WA * 20 |
ソースコード
n = int(input()) s = input().strip() # Split into three groups based on position mod 3 (1-based) group1 = [] group2 = [] group3 = [] for i in range(len(s)): pos = i + 1 # Convert to 1-based index if pos % 3 == 1: group1.append(s[i]) elif pos % 3 == 2: group2.append(s[i]) else: group3.append(s[i]) # Count 'c', 'o', 'n' in each group def count_chars(group): c = group.count('c') o = group.count('o') n = group.count('n') return c, o, n c1, o1, n1 = count_chars(group1) c2, o2, n2 = count_chars(group2) c3, o3, n3 = count_chars(group3) # Calculate the maximum possible 'con' for each triplet type type1 = min(c1, o2, n3) type2 = min(c2, o3, n1) type3 = min(c3, o1, n2) total = type1 + type2 + type3 print(total)