結果

問題 No.457 (^^*)
ユーザー GrayCoderGrayCoder
提出日時 2017-11-23 17:52:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 835 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 13,872 KB
最終ジャッジ日時 2023-08-18 03:23:31
合計ジャッジ時間 4,619 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
13,436 KB
testcase_01 AC 27 ms
8,992 KB
testcase_02 AC 27 ms
9,008 KB
testcase_03 AC 28 ms
9,016 KB
testcase_04 AC 27 ms
8,972 KB
testcase_05 AC 25 ms
9,020 KB
testcase_06 AC 26 ms
9,036 KB
testcase_07 AC 26 ms
9,104 KB
testcase_08 AC 30 ms
8,940 KB
testcase_09 AC 40 ms
9,024 KB
testcase_10 AC 102 ms
9,064 KB
testcase_11 AC 327 ms
9,244 KB
testcase_12 TLE -
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:
        flagl = flagr = 0
        for j in br:
            if j - i < 4:
                continue
            if flagl:
                left += 1
            else:
                l = re.search(r'\^.*\^.*\*', S[i:j+1])
                if l is not None:
                    left += 1
                    flagl = 1
            if flagr:
                right += 1
            else:
                r = re.search(r'\*.*\^.*\^', S[i:j+1])
                if r is not None:
                    right += 1
                    flagr = 1

    print(left, right)

main()
0