結果
問題 | No.592 括弧の対応 (2) |
ユーザー | htkb |
提出日時 | 2017-11-10 22:31:47 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 135 ms / 5,000 ms |
コード長 | 289 bytes |
コンパイル時間 | 788 ms |
コンパイル使用メモリ | 10,652 KB |
実行使用メモリ | 32,528 KB |
最終ジャッジ日時 | 2023-08-16 03:05:40 |
合計ジャッジ時間 | 1,191 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 18 ms
8,452 KB |
testcase_01 | AC | 135 ms
32,168 KB |
testcase_02 | AC | 127 ms
32,528 KB |
testcase_03 | AC | 130 ms
32,212 KB |
ソースコード
from collections import deque N = int(input()) s = input() result = [0]*N dq = deque() append, pop = dq.append, dq.pop for i, c in enumerate(s): if c == "(": append(i) else: n = pop() result[n] = i+1 result[i] = n+1 print("\n".join(map(str,result)))