結果
問題 | No.2276 I Want AC |
ユーザー |
![]() |
提出日時 | 2023-04-21 21:32:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 67 ms / 2,000 ms |
コード長 | 403 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 82,356 KB |
実行使用メモリ | 75,716 KB |
最終ジャッジ日時 | 2024-11-06 15:00:23 |
合計ジャッジ時間 | 5,040 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 56 |
ソースコード
n = int(input()) s = input() now = 0 a_left = 0 for c in s: if c == 'A': a_left += 1 else: now += a_left ans = now c_right = n - a_left a_left = 0 for i in range(n): if s[i] == 'A': a_left += 1 elif s[i] == 'C': c_right -= 1 else: now -= a_left c_right -= 1 a_left += 1 now += c_right ans = max(ans, now) print(ans)