結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-22 22:03:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 477 bytes |
| コンパイル時間 | 210 ms |
| コンパイル使用メモリ | 82,912 KB |
| 実行使用メモリ | 76,532 KB |
| 最終ジャッジ日時 | 2024-11-18 13:24:40 |
| 合計ジャッジ時間 | 5,266 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 20 |
ソースコード
from bisect import bisect
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
n = bisect(txt['G'], k)
if txt['G'][n-1] == k:
ans += 1
print(ans)
input = lambda: stdin.readline().rstrip()
main()