結果
| 問題 |
No.2073 Concon Substrings (Swap Version)
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-09 20:56:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 603 bytes |
| コンパイル時間 | 515 ms |
| コンパイル使用メモリ | 82,376 KB |
| 実行使用メモリ | 77,448 KB |
| 最終ジャッジ日時 | 2025-04-09 20:57:30 |
| 合計ジャッジ時間 | 4,484 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 25 WA * 12 |
ソースコード
n = int(input())
s = input().strip()
# Initialize counts for 'c', 'o', 'n' in each group (0, 1, 2)
counts = [{'c': 0, 'o': 0, 'n': 0} for _ in range(3)]
for idx in range(len(s)):
group = (idx + 1) % 3 # Determine group based on 1-based index
c = s[idx]
if c in ['c', 'o', 'n']:
counts[group][c] += 1
# Calculate the maximum possible 'con' for each type
type0 = min(counts[0]['c'], counts[1]['o'], counts[2]['n'], n - 1)
type1 = min(counts[1]['c'], counts[2]['o'], counts[0]['n'], n)
type2 = min(counts[2]['c'], counts[0]['o'], counts[1]['n'], n - 1)
print(type0 + type1 + type2)
lam6er