結果

問題 No.457 (^^*)
ユーザー GrayCoderGrayCoder
提出日時 2017-11-23 17:43:18
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 9,468 KB
最終ジャッジ日時 2023-08-18 03:22:09
合計ジャッジ時間 4,787 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
9,012 KB
testcase_01 AC 24 ms
9,012 KB
testcase_02 AC 25 ms
9,008 KB
testcase_03 AC 26 ms
9,112 KB
testcase_04 WA -
testcase_05 AC 24 ms
9,008 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1,063 ms
9,388 KB
testcase_13 AC 126 ms
9,420 KB
testcase_14 AC 27 ms
9,392 KB
testcase_15 WA -
testcase_16 AC 126 ms
9,396 KB
testcase_17 WA -
testcase_18 AC 25 ms
9,076 KB
testcase_19 AC 26 ms
9,160 KB
権限があれば一括ダウンロードができます

ソースコード

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 flagl:
                left += 1
                continue
            if flagr:
                left += 1
                continue
            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
            flagl = flagr = 1

    print(left, right)

main()
0