結果

問題 No.805 UMG
ユーザー UekiUeki
提出日時 2019-03-22 23:04:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 76,212 KB
最終ジャッジ日時 2023-08-11 19:19:32
合計ジャッジ時間 4,079 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,156 KB
testcase_01 AC 74 ms
71,080 KB
testcase_02 AC 75 ms
70,968 KB
testcase_03 AC 76 ms
71,060 KB
testcase_04 AC 76 ms
71,076 KB
testcase_05 AC 75 ms
70,980 KB
testcase_06 AC 77 ms
70,980 KB
testcase_07 AC 76 ms
70,980 KB
testcase_08 AC 75 ms
71,092 KB
testcase_09 AC 74 ms
70,968 KB
testcase_10 AC 77 ms
71,288 KB
testcase_11 AC 77 ms
71,124 KB
testcase_12 AC 74 ms
70,980 KB
testcase_13 AC 75 ms
70,964 KB
testcase_14 AC 76 ms
71,060 KB
testcase_15 AC 87 ms
75,788 KB
testcase_16 AC 83 ms
75,648 KB
testcase_17 AC 82 ms
75,800 KB
testcase_18 AC 86 ms
76,212 KB
testcase_19 AC 83 ms
75,684 KB
testcase_20 AC 84 ms
76,028 KB
testcase_21 AC 83 ms
75,752 KB
testcase_22 AC 84 ms
75,664 KB
testcase_23 AC 108 ms
75,876 KB
testcase_24 AC 105 ms
76,108 KB
testcase_25 AC 105 ms
75,892 KB
testcase_26 AC 103 ms
76,148 KB
testcase_27 AC 103 ms
76,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
S = input()[:-1]

U = []
ans = 0
for i, c in enumerate(S):
    if c == "U":
        U.append(i)
    elif c == "M":
        for u in U:
            if 2*i-u < N and S[i+i-u] == "G":
                ans += 1
print(ans)
0