結果

問題 No.457 (^^*)
ユーザー shiccocsanshiccocsan
提出日時 2016-12-08 08:40:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 521 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,248 KB
最終ジャッジ日時 2024-11-28 07:50:30
合計ジャッジ時間 24,334 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

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