結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2020-11-25 06:31:04 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 41 ms / 5,000 ms |
| + 300µs | |
| コード長 | 348 bytes |
| 記録 | |
| コンパイル時間 | 87 ms |
| コンパイル使用メモリ | 64,448 KB |
| 実行使用メモリ | 58,752 KB |
| 最終ジャッジ日時 | 2026-11-10 22:19:17 |
| 合計ジャッジ時間 | 2,574 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
n,k = map(int,input().split())
s = input()
st = []
for i,si in enumerate(s):
i += 1
if st and st[-1][0] == "(" and si == ")":
if i == k:
ans = st[-1][1]
break
elif st[-1][1] == k:
ans = i
break
else:
st.pop()
else:
st.append((si,i))
print(ans)
convexineq