結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
nohakai3
|
| 提出日時 | 2022-10-22 10:57:20 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 41 ms / 5,000 ms |
| + 534µs | |
| コード長 | 313 bytes |
| 記録 | |
| コンパイル時間 | 122 ms |
| コンパイル使用メモリ | 64,416 KB |
| 実行使用メモリ | 59,140 KB |
| 最終ジャッジ日時 | 2026-11-11 00:03:45 |
| 合計ジャッジ時間 | 3,016 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
n,k=map(int,input().split())
l=list(input())
from collections import deque
s=deque()
ans=[]
for i in range(n):
if l[i]=="(":
s.append(i)
else:
ans.append([i+1,s.pop()+1])
for x in ans:
if x[0]==k:
print(x[1])
exit()
elif x[1]==k:
print(x[0])
exit()
nohakai3