結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-10 11:35:06 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 41 ms / 5,000 ms |
| + 841µs | |
| コード長 | 327 bytes |
| 記録 | |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 64,340 KB |
| 実行使用メモリ | 59,052 KB |
| 最終ジャッジ日時 | 2026-11-10 22:30:10 |
| 合計ジャッジ時間 | 2,529 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
N,K = map(int,input().split())
S = list(input())
ls = []
pair = [-1]*(N)
for i in range(N):
ls.append((S[i],i))
if len(ls) >= 2:
if ls[-1][0] == ')' and ls[-2][0] == '(':
pair[ls[-1][1]] = ls[-2][1]
pair[ls[-2][1]] = ls[-1][1]
ls.pop()
ls.pop()
print(pair[K-1]+1)