結果
問題 | No.2073 Concon Substrings (Swap Version) |
ユーザー |
![]() |
提出日時 | 2025-05-14 12:49:58 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 496 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 77,176 KB |
最終ジャッジ日時 | 2025-05-14 12:51:18 |
合計ジャッジ時間 | 3,561 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 17 WA * 20 |
ソースコード
n = int(input()) s = input().strip() # Initialize counts for 'c', 'o', 'n' in each of the three groups (0, 1, 2) c = [0, 0, 0] o = [0, 0, 0] n_ = [0, 0, 0] for i in range(len(s)): group = i % 3 char = s[i] if char == 'c': c[group] += 1 elif char == 'o': o[group] += 1 elif char == 'n': n_[group] += 1 # Calculate the maximum possible 'con' substrings max_con = min(c[0], o[1], n_[2]) + min(c[1], o[2], n_[0]) + min(c[2], o[0], n_[1]) print(max_con)