結果
| 問題 | No.805 UMG |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-22 22:27:59 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 2,000 ms |
| コード長 | 510 bytes |
| 記録 | |
| コンパイル時間 | 149 ms |
| コンパイル使用メモリ | 85,760 KB |
| 実行使用メモリ | 68,224 KB |
| 最終ジャッジ日時 | 2026-05-13 01:19:29 |
| 合計ジャッジ時間 | 2,293 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()