結果

問題 No.457 (^^*)
ユーザー GrayCoderGrayCoder
提出日時 2017-11-23 18:23:16
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 875 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 13,320 KB
最終ジャッジ日時 2023-08-18 03:25:24
合計ジャッジ時間 4,629 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
13,320 KB
testcase_01 AC 27 ms
9,104 KB
testcase_02 AC 26 ms
8,944 KB
testcase_03 AC 25 ms
8,940 KB
testcase_04 AC 25 ms
9,008 KB
testcase_05 AC 25 ms
9,052 KB
testcase_06 AC 25 ms
9,000 KB
testcase_07 AC 26 ms
8,956 KB
testcase_08 AC 30 ms
9,068 KB
testcase_09 AC 38 ms
8,976 KB
testcase_10 AC 101 ms
9,232 KB
testcase_11 AC 322 ms
9,104 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
    pl = re.compile(r'\^.*\^.*\*')
    pr = re.compile(r'\*.*\^.*\^')
    for i in bl:
        flagl = flagr = 0
        for j in br:
            if j - i < 4:
                continue
            if flagl:
                left += 1
            else:
                l = pl.search(S[i:j+1])
                if l is not None:
                    left += 1
                    flagl = 1
            if flagr:
                right += 1
            else:
                r = pr.search(S[i:j+1])
                if r is not None:
                    right += 1
                    flagr = 1

    print(left, right)

main()
0