結果

問題 No.805 UMG
ユーザー lemonlemon
提出日時 2021-06-15 18:22:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 76,456 KB
最終ジャッジ日時 2023-08-11 19:59:39
合計ジャッジ時間 4,245 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
75,884 KB
testcase_01 AC 82 ms
76,044 KB
testcase_02 AC 77 ms
75,816 KB
testcase_03 AC 78 ms
75,860 KB
testcase_04 AC 75 ms
71,236 KB
testcase_05 AC 74 ms
71,216 KB
testcase_06 AC 75 ms
71,320 KB
testcase_07 AC 79 ms
75,828 KB
testcase_08 AC 78 ms
75,948 KB
testcase_09 AC 78 ms
75,804 KB
testcase_10 AC 73 ms
71,188 KB
testcase_11 AC 76 ms
75,900 KB
testcase_12 AC 73 ms
71,436 KB
testcase_13 AC 82 ms
75,888 KB
testcase_14 AC 73 ms
71,100 KB
testcase_15 AC 90 ms
76,308 KB
testcase_16 AC 87 ms
76,296 KB
testcase_17 AC 86 ms
76,228 KB
testcase_18 AC 86 ms
76,260 KB
testcase_19 AC 83 ms
76,432 KB
testcase_20 AC 90 ms
76,256 KB
testcase_21 AC 88 ms
76,364 KB
testcase_22 AC 84 ms
76,228 KB
testcase_23 AC 184 ms
76,456 KB
testcase_24 AC 192 ms
76,300 KB
testcase_25 AC 191 ms
76,328 KB
testcase_26 AC 194 ms
76,312 KB
testcase_27 AC 189 ms
76,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
nsa = lambda: list(map(str, stdin.readline().split()))
ntp = lambda: tuple(map(int, stdin.readline().split()))
mod = 10 ** 9 + 7
inf = 10 ** 18

n = ni()
S = ns()
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        k = 2 * (j + 1) - (i + 1) - 1
        if j < k < n:
            if S[i] == 'U' and S[j] == 'M' and S[k] == 'G':
                ans += 1

print(ans)
0