結果
| 問題 | No.2276 I Want AC |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-28 00:41:35 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 336 bytes |
| 記録 | |
| コンパイル時間 | 365 ms |
| コンパイル使用メモリ | 84,884 KB |
| 実行使用メモリ | 89,728 KB |
| 最終ジャッジ日時 | 2026-05-28 00:41:41 |
| 合計ジャッジ時間 | 5,311 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 12 WA * 44 |
ソースコード
n=int(input())
a=list(input())
c=0;b=0
d=0;f=0
for i in a:
if i=="?":
c+=1
if i=="A":
d+=1
if i=="C":
f+=d;b+=1
ans=f;d=0;s=0
for i in a:
if i=="?":
ans=max(ans,f+s*c+d*c+b*s)
s+=1;c-=1
if i=="A":
d+=1
if i=="C":
b-=1
ans=max(ans,f+s*c+d*c+b*s)
print(ans)