結果
| 問題 | No.2073 Concon Substrings (Swap Version) |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-09-16 21:32:43 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 51 ms / 2,000 ms |
| + 438µs | |
| コード長 | 431 bytes |
| 記録 | |
| コンパイル時間 | 89 ms |
| コンパイル使用メモリ | 64,864 KB |
| 実行使用メモリ | 59,364 KB |
| 最終ジャッジ日時 | 2026-10-20 06:38:37 |
| 合計ジャッジ時間 | 4,466 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 38 |
ソースコード
n = int(input())
S = input()
cnt = [[0] * 3 for _ in range(3)]
for i, s in enumerate(S):
if s == "c":
cnt[i % 3][0] += 1
elif s == "o":
cnt[i % 3][1] += 1
elif s == "n":
cnt[i % 3][2] += 1
ans = 0
lst = []
for i in range(3):
mi = 1 << 30
for j in range(3):
mi = min(mi, cnt[(i + j) % 3][j])
lst.append(mi)
ans += mi
if ans == n and n != lst[0]:
ans -= 1
print(ans)