結果
問題 |
No.22 括弧の対応
|
ユーザー |
![]() |
提出日時 | 2021-05-22 18:35:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 50 ms / 5,000 ms |
コード長 | 407 bytes |
コンパイル時間 | 374 ms |
コンパイル使用メモリ | 82,128 KB |
実行使用メモリ | 55,680 KB |
最終ジャッジ日時 | 2024-10-10 17:00:29 |
合計ジャッジ時間 | 2,189 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import sys import math from math import sin, cos, tan from functools import reduce from collections import deque import heapq sys.setrecursionlimit(1000000) intm1 = lambda x:int(x)-1 N, K = map(int,input().split()) K -= 1 S = input() cnt = 1 if S[K] == '(' else -1 for i in range(K + 1, N, 1) if S[K] == '(' else range(K - 1, -1, -1): cnt += 1 if S[i] == '(' else -1 if cnt == 0: print(i + 1) break