結果
問題 | No.457 (^^*) |
ユーザー |
![]() |
提出日時 | 2025-02-18 21:51:16 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 80 ms / 2,000 ms |
コード長 | 825 bytes |
コンパイル時間 | 864 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 75,904 KB |
最終ジャッジ日時 | 2025-02-18 21:51:21 |
合計ジャッジ時間 | 2,389 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
from bisect import bisect S = input() N = len(S) LB = [] M = [] A = [] ansr = 0 ansl = 0 for i, s in enumerate(S): if s == "(": LB.append(i) if s == "^": M.append(i) if s == "*": A.append(i) if s == ")": if A: x = A[-1] if M: y = bisect(M, x) - 1 if y > 0: y = M[y - 1] if LB: z = bisect(LB, y) #print("L", A[z - 1], y, x) ansl += z if len(M) > 1: x = M[-2] if A: y = bisect(A, x) - 1 if LB and y >= 0: z = bisect(LB, A[y]) #print("R", LB[z - 1], A[y], x) ansr += z print(ansl, ansr)