結果
問題 | No.22 括弧の対応 |
ユーザー |
![]() |
提出日時 | 2025-01-24 02:09:22 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 10 ms / 5,000 ms |
コード長 | 302 bytes |
コンパイル時間 | 11,827 ms |
コンパイル使用メモリ | 248,720 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-24 02:09:35 |
合計ジャッジ時間 | 12,603 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
package mainimport . "fmt"func main() {var n,k intvar s stringScan(&n,&k,&s)p := make([]int, n)t := make([]int, 0, n)for i,r := range s {switch r {case '(':t=append(t,i)case ')':x := len(t)j:=t[x-1]t=t[:x-1]p[i],p[j]=j+1,i+1}}Println(p[k-1])}