結果

問題 No.1159 Sashiming String
ユーザー yansi819yansi819
提出日時 2024-05-08 12:56:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 321 bytes
コンパイル時間 521 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 78,848 KB
最終ジャッジ日時 2024-05-08 12:56:15
合計ジャッジ時間 2,026 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,352 KB
testcase_01 WA -
testcase_02 AC 54 ms
65,664 KB
testcase_03 AC 50 ms
60,928 KB
testcase_04 AC 54 ms
65,664 KB
testcase_05 AC 55 ms
67,456 KB
testcase_06 AC 57 ms
65,664 KB
testcase_07 AC 55 ms
66,304 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 39 ms
52,352 KB
testcase_11 AC 38 ms
52,096 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *

S = input()

T = []
for i in range(len(S)):
    if S[i] == 'i':
        if i < len(S) - 3:
            if S[i + 1] == 'n' and S[i + 2] == 'g':
                T.append(i)
                i += 2
ans = 0
for i in range(len(S)):
    if S[i] == 'S':
        ans += len(T) - bisect_left(T, i)

print(ans)
0