結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:42:39 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 582 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,412 KB |
実行使用メモリ | 76,864 KB |
最終ジャッジ日時 | 2025-06-12 21:46:27 |
合計ジャッジ時間 | 3,378 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 17 WA * 20 |
ソースコード
n = int(input()) s = input().strip() groups = [[0, 0, 0] for _ in range(3)] # groups[mod][0] = 'c', groups[mod][1] = 'o', groups[mod][2] = 'n' for i in range(len(s)): c = s[i] mod = i % 3 if c == 'c': groups[mod][0] += 1 elif c == 'o': groups[mod][1] += 1 elif c == 'n': groups[mod][2] += 1 max_con = 0 for start_mod in range(3): c_mod = start_mod o_mod = (start_mod + 1) % 3 n_mod = (start_mod + 2) % 3 c = groups[c_mod][0] o = groups[o_mod][1] n = groups[n_mod][2] max_con += min(c, o, n) print(max_con)