結果

問題 No.805 UMG
ユーザー GrayCoderGrayCoder
提出日時 2019-03-22 22:27:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 77,584 KB
最終ジャッジ日時 2023-08-11 19:18:10
合計ジャッジ時間 4,273 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
71,520 KB
testcase_01 AC 88 ms
71,444 KB
testcase_02 AC 92 ms
71,524 KB
testcase_03 AC 86 ms
71,688 KB
testcase_04 AC 88 ms
71,616 KB
testcase_05 AC 87 ms
71,640 KB
testcase_06 AC 87 ms
71,248 KB
testcase_07 AC 88 ms
71,628 KB
testcase_08 AC 87 ms
71,544 KB
testcase_09 AC 88 ms
71,416 KB
testcase_10 AC 88 ms
71,628 KB
testcase_11 AC 87 ms
71,560 KB
testcase_12 AC 88 ms
71,756 KB
testcase_13 AC 86 ms
71,532 KB
testcase_14 AC 87 ms
71,448 KB
testcase_15 AC 97 ms
77,216 KB
testcase_16 AC 95 ms
77,144 KB
testcase_17 AC 96 ms
77,212 KB
testcase_18 AC 96 ms
77,156 KB
testcase_19 AC 96 ms
76,404 KB
testcase_20 AC 95 ms
77,176 KB
testcase_21 AC 94 ms
77,284 KB
testcase_22 AC 101 ms
77,224 KB
testcase_23 AC 130 ms
77,124 KB
testcase_24 AC 126 ms
77,472 KB
testcase_25 AC 129 ms
77,584 KB
testcase_26 AC 129 ms
77,304 KB
testcase_27 AC 130 ms
77,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
0