結果
| 問題 |
No.22 括弧の対応
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-23 22:41:09 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 362 bytes |
| コンパイル時間 | 92 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-08 02:11:23 |
| 合計ジャッジ時間 | 1,422 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 17 |
ソースコード
n,k=map(int,input().split())
s=input()
a=s[k-1]
ans=0
if a=="(":
for i in range(k,n):
if ans==0 and s[i]==")":
print(i+1)
else:
if s[i]=="(":
ans+=1
else:
ans-=1
if a==")":
for i in range(k-2,0,-1):
if ans==0 and s[i]=="(":
print(i+1)
else:
if s[i]=="(":
ans-=1
else:
ans+=1