結果
問題 | No.2276 I Want AC |
ユーザー |
![]() |
提出日時 | 2023-04-21 21:38:08 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 347 ms / 2,000 ms |
コード長 | 307 bytes |
コンパイル時間 | 188 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 26,716 KB |
最終ジャッジ日時 | 2024-11-06 15:07:51 |
合計ジャッジ時間 | 13,366 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 56 |
ソースコード
n = int(input()); s = input() a = [0]*n; c = [0]*n; ans = 0 for i in range(n): if i>0: a[i] = a[i-1] if s[i]!="C": a[i] += 1 else: ans += a[i] x = ans for i in range(n-1,-1,-1): if i<n-1: c[i] = c[i+1] if s[i]!="A": c[i] += 1 if s[i]=="?": x += a[i]-c[i]; ans = max(ans,x) print(ans)