結果

問題 No.22 括弧の対応
ユーザー gigurururu
提出日時 2015-04-08 18:17:24
言語 Ruby
(3.4.1)
結果
AC  
実行時間 103 ms / 5,000 ms
コード長 132 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-07-20 06:58:53
合計ジャッジ時間 2,995 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n,k=gets.split
a=[]
t=[]
gets.chomp.each_char.with_index(1){|c,i|
  if c==?(
    t<<i
  else
    a[a[i]=t.pop]=i
  end
}
p a[k.to_i]
0