結果
問題 |
No.2276 I Want AC
|
ユーザー |
![]() |
提出日時 | 2024-08-15 11:43:32 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 303 ms / 2,000 ms |
コード長 | 397 bytes |
コンパイル時間 | 218 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 14,020 KB |
最終ジャッジ日時 | 2024-08-15 11:43:46 |
合計ジャッジ時間 | 13,679 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 56 |
ソースコード
N=int(input()) S=list(input()) AC=[False]*N for i in range(N): if S[i]=="?": AC[i]=True S[i]="C" cnt=0 a=0 for s in S: if s=="A": a+=1 else: cnt+=a ans=cnt a=0 c=S.count("C") for i in range(N): if AC[i]: S[i]="A" c-=1 cnt-=a cnt+=c if S[i]=="A": a+=1 else: c-=1 ans=max(ans,cnt) print(ans)