結果
| 問題 | No.805 UMG | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-03-22 21:55:32 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 410 bytes | 
| コンパイル時間 | 384 ms | 
| コンパイル使用メモリ | 82,188 KB | 
| 実行使用メモリ | 130,356 KB | 
| 最終ジャッジ日時 | 2024-11-18 13:20:21 | 
| 合計ジャッジ時間 | 17,374 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 WA * 15 TLE * 5 | 
ソースコード
from collections import defaultdict
from sys import stdin
def main():
    N = int(input())
    S = input()
    txt = defaultdict(list)
    for i, s in enumerate(S, start=1):
        txt[s].append(i)
    ans = 0
    for j in txt['M']:
        for i in txt['U']:
            k = j - i + j
            if k in txt['G']:
                ans += 1
    print(ans)
input = lambda: stdin.readline().rstrip()
main()
            
            
            
        