結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-14 21:13:44 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 51 ms / 5,000 ms |
| + 335µs | |
| コード長 | 466 bytes |
| 記録 | |
| コンパイル時間 | 101 ms |
| コンパイル使用メモリ | 64,276 KB |
| 実行使用メモリ | 60,004 KB |
| 最終ジャッジ日時 | 2026-11-11 00:42:15 |
| 合計ジャッジ時間 | 3,164 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
# 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)