結果
問題 | No.805 UMG |
ユーザー |
|
提出日時 | 2019-03-22 22:27:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 85 ms / 2,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 424 ms |
コンパイル使用メモリ | 82,100 KB |
実行使用メモリ | 68,512 KB |
最終ジャッジ日時 | 2024-11-18 13:27:26 |
合計ジャッジ時間 | 2,597 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
from collections import defaultdict from sys import stdin def main(): N = int(input()) S = input() txt = defaultdict(list) for i, s in enumerate(S): txt[s].append(i) ans = 0 for i in txt['U']: for n in range(1, 2500): m = i + n g = m + n if g >= N: break else: if S[m] == 'M' and S[g] == 'G': ans += 1 print(ans) input = lambda: stdin.readline().rstrip() main()