結果

問題 No.805 UMG
ユーザー GrayCoderGrayCoder
提出日時 2019-03-22 22:03:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 82,028 KB
実行使用メモリ 76,716 KB
最終ジャッジ日時 2024-04-29 10:36:59
合計ジャッジ時間 5,284 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
54,944 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 40 ms
54,112 KB
testcase_04 AC 40 ms
55,660 KB
testcase_05 AC 40 ms
54,120 KB
testcase_06 AC 40 ms
54,192 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 39 ms
55,092 KB
testcase_11 WA -
testcase_12 AC 41 ms
54,540 KB
testcase_13 WA -
testcase_14 AC 39 ms
54,068 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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