結果
問題 | No.22 括弧の対応 |
ユーザー |
|
提出日時 | 2023-06-14 21:13:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 51 ms / 5,000 ms |
コード長 | 466 bytes |
コンパイル時間 | 377 ms |
コンパイル使用メモリ | 82,008 KB |
実行使用メモリ | 66,888 KB |
最終ジャッジ日時 | 2024-06-23 03:14:32 |
合計ジャッジ時間 | 2,181 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
# import pypyjit # pypyjit.set_param('max_unroll_recursion=-1') from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N,K = map(int,input().split()) S = list(input())[:-1] L = deque() R = deque() Y = defaultdict(lambda:-1) for i,s in enumerate(S): if s==')': j = L.pop() Y[j]=i Y[i]=j else: L.append(i) print(Y[K-1]+1)