結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-22 01:00:22 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 101 ms / 5,000 ms |
| + 473µs | |
| コード長 | 753 bytes |
| 記録 | |
| コンパイル時間 | 518 ms |
| コンパイル使用メモリ | 21,412 KB |
| 実行使用メモリ | 15,868 KB |
| 最終ジャッジ日時 | 2026-08-19 18:31:00 |
| 合計ジャッジ時間 | 3,631 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
n, k = map(int, input().split())
s = list(input())
close_index = 0
open_index = len(s) - 1
is_find = False
while close_index < len(s):
if s[close_index] == ')':
s[close_index] = 'checked'
open_index = close_index
while open_index >= 0:
if s[open_index] == '(':
s[open_index] = 'checked'
if close_index + 1 == k:
print(open_index + 1)
is_find = True
break
elif open_index + 1 == k:
print(close_index + 1)
is_find = True
break
break
else:
open_index -= 1
if is_find: break
close_index += 1