結果
問題 | No.2276 I Want AC |
ユーザー |
|
提出日時 | 2023-04-21 22:05:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 86 ms / 2,000 ms |
コード長 | 633 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 82,688 KB |
実行使用メモリ | 76,544 KB |
最終ジャッジ日時 | 2024-11-06 15:34:52 |
合計ジャッジ時間 | 6,009 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 56 |
ソースコード
import sysfrom collections import deque, Counterinput = lambda: sys.stdin.readline().rstrip()ii = lambda: int(input())mi = lambda: map(int, input().split())li = lambda: list(mi())inf = 2 ** 63 - 1mod = 998244353n = ii()s = input()counta = 0countc = 0ans = 0for v in s:if v == 'C' or v == '?':ans += countacountc += 1else:counta += 1counta = 0now = ansfor v in s:if v == 'A':counta += 1if v == 'C':countc -= 1if v == '?':countc -= 1now += countcnow -= countaans = max(ans, now)counta += 1print(ans)