結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
_KingdomOfMoray
|
| 提出日時 | 2019-12-30 09:49:56 |
| 言語 | Python3 (3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 3,824 ms / 5,000 ms |
| + 269µs | |
| コード長 | 577 bytes |
| 記録 | |
| コンパイル時間 | 53 ms |
| コンパイル使用メモリ | 14,720 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2026-11-10 20:31:03 |
| 合計ジャッジ時間 | 8,633 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
input_list = list(map(int,input().split()))
n, k = input_list
s = input()
s_list = list(s)
len_s = len(s_list)
comb_list = []
checked = 0
res = None
while checked != n:
close_index = s_list.index(')')
open_index = None
for i in range(close_index):
if s_list[i] == '(':
open_index = i
if open_index == k - 1:
res = close_index + 1
break
elif close_index == k - 1:
res = open_index + 1
break
s_list[close_index] = 'x'
s_list[open_index] = 'x'
checked += 2
print(res)
_KingdomOfMoray