結果

問題 No.457 (^^*)
ユーザー GrayCoderGrayCoder
提出日時 2018-06-30 08:48:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 623 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 13,656 KB
最終ジャッジ日時 2023-09-13 16:11:56
合計ジャッジ時間 6,530 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
13,560 KB
testcase_01 AC 25 ms
9,008 KB
testcase_02 AC 27 ms
9,016 KB
testcase_03 AC 27 ms
9,008 KB
testcase_04 AC 26 ms
8,956 KB
testcase_05 AC 26 ms
9,000 KB
testcase_06 AC 25 ms
8,952 KB
testcase_07 AC 33 ms
9,060 KB
testcase_08 AC 68 ms
9,008 KB
testcase_09 AC 219 ms
9,176 KB
testcase_10 AC 1,955 ms
9,000 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import re

def main():
    S = input()

    bracketsL, bracketsR = [], []
    s = S.find('(')
    e = len(S) - S[::-1].find(')')
    for i, t in enumerate(S[s:e]):
        if t == '(':
            bracketsL.append(i + s)
        elif t == ')':
            bracketsR.append(i + s + 1)

    regexl = re.compile(r'\^.*\^.*\*')
    regexr = re.compile(r'\*.*\^.*\^')
    left, right = 0, 0
    for i in bracketsL:
        for j in bracketsR:
            if regexl.search(S[i:j]) is not None:
                left += 1
            if regexr.search(S[i:j]) is not None:
                right += 1

    print(left, right)

main()
0