結果
| 問題 | No.2276 I Want AC |
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2023-04-21 21:32:37 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 38 ms / 2,000 ms |
| + 733µs | |
| コード長 | 403 bytes |
| 記録 | |
| コンパイル時間 | 62 ms |
| コンパイル使用メモリ | 82,160 KB |
| 実行使用メモリ | 77,696 KB |
| 最終ジャッジ日時 | 2026-09-19 18:13:58 |
| 合計ジャッジ時間 | 4,823 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
Kude