結果
問題 | No.457 (^^*) |
ユーザー | GrayCoder |
提出日時 | 2018-06-30 09:05:40 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 819 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 11,028 KB |
実行使用メモリ | 13,848 KB |
最終ジャッジ日時 | 2023-09-13 16:12:09 |
合計ジャッジ時間 | 5,209 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
13,516 KB |
testcase_01 | AC | 25 ms
9,000 KB |
testcase_02 | AC | 26 ms
8,968 KB |
testcase_03 | AC | 24 ms
9,136 KB |
testcase_04 | AC | 25 ms
9,104 KB |
testcase_05 | AC | 23 ms
9,012 KB |
testcase_06 | AC | 24 ms
8,968 KB |
testcase_07 | AC | 26 ms
9,012 KB |
testcase_08 | AC | 35 ms
9,120 KB |
testcase_09 | AC | 62 ms
9,080 KB |
testcase_10 | AC | 236 ms
9,084 KB |
testcase_11 | AC | 851 ms
9,172 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
ソースコード
import re def main(): S = input() bracketsL, bracketsR = [], [] s = S.find('(') e = len(S) - S[::-1].find(')') for i, t in enumerate(S[s:e]): if t == '(': bracketsL.append(i + s) elif t == ')': bracketsR.append(i + s + 1) bracketsL.sort(reverse=1) regexl = re.compile(r'\^.*\^.*\*') regexr = re.compile(r'\*.*\^.*\^') left, right = 0, 0 for i in bracketsL: flagL, flagR = False, False for j in bracketsR: if not flagL and regexl.search(S[i:j]) is not None: flagL = True if not flagR and regexr.search(S[i:j]) is not None: flagR = True if flagL: left += 1 if flagR: right += 1 print(left, right) main()