結果
問題 | No.805 UMG |
ユーザー |
![]() |
提出日時 | 2021-06-16 09:21:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 96 ms / 2,000 ms |
コード長 | 320 bytes |
コンパイル時間 | 613 ms |
コンパイル使用メモリ | 82,588 KB |
実行使用メモリ | 67,712 KB |
最終ジャッジ日時 | 2024-11-18 14:11:00 |
合計ジャッジ時間 | 2,816 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
import collections N = int(input()) S= input() U = [] M = [] G = collections.defaultdict(int) for i in range(N): if S[i]=='U': U.append(i) elif S[i]=='M': M.append(i) else: G[i]=1 ans = 0 for u in U: for m in M: if u<m and G[u+(m-u)*2]==1: ans+=1 print(ans)