結果

問題 No.457 (^^*)
ユーザー GrayCoderGrayCoder
提出日時 2017-11-23 17:36:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 591 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 13,544 KB
最終ジャッジ日時 2023-08-18 03:21:50
合計ジャッジ時間 6,888 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
13,364 KB
testcase_01 AC 25 ms
9,024 KB
testcase_02 AC 26 ms
9,040 KB
testcase_03 AC 25 ms
8,932 KB
testcase_04 AC 25 ms
8,980 KB
testcase_05 AC 25 ms
9,024 KB
testcase_06 AC 26 ms
9,100 KB
testcase_07 AC 36 ms
9,044 KB
testcase_08 AC 80 ms
9,072 KB
testcase_09 AC 264 ms
8,992 KB
testcase_10 TLE -
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()

    bl = []
    br = []
    apndl = bl.append
    apndr = br.append
    for i in range(len(S)):
        if S[i] == '(':
            apndl(i)
        elif S[i] == ')':
            apndr(i)

    left = 0
    right = 0
    for i in bl:
        for j in br:
            if i + 3 < j:
                l = re.search(r'\^.*\^.*\*', S[i:j+1])
                if l is not None:
                    left += 1
                r = re.search(r'\*.*\^.*\^', S[i:j+1])
                if r is not None:
                    right += 1

    print(left, right)

main()
0