結果

問題 No.457 (^^*)
ユーザー shiccocsanshiccocsan
提出日時 2016-12-08 08:40:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 521 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2024-05-06 04:26:11
合計ジャッジ時間 6,245 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
16,000 KB
testcase_01 AC 28 ms
10,496 KB
testcase_02 AC 28 ms
10,496 KB
testcase_03 AC 27 ms
10,624 KB
testcase_04 AC 27 ms
10,496 KB
testcase_05 AC 25 ms
10,496 KB
testcase_06 AC 30 ms
10,624 KB
testcase_07 AC 41 ms
10,496 KB
testcase_08 AC 94 ms
10,496 KB
testcase_09 AC 269 ms
10,496 KB
testcase_10 AC 1,519 ms
10,624 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import re

S = input()

right = re.compile(r"\*.*\^.*\^")
left = re.compile(r"\^.*\^.*\*")

rc = 0
lc = 0
for i in range(len(S)):
    rf = False
    lf = False
    for j in range(i + 4, len(S)):
        if S[i] == '(' and S[j] == ')':
            if not rf and right.search(S[i + 1:j]):
                rc += S.count(')', j)
                rf = True
            if not lf and left.search(S[i + 1:j]):
                lc += S.count(')', j)
                lf = True
        if rf and lf:
            break

print(lc, rc)
0