結果
問題 |
No.592 括弧の対応 (2)
|
ユーザー |
![]() |
提出日時 | 2018-03-14 07:10:43 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 990 ms / 5,000 ms |
コード長 | 176 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 30,720 KB |
最終ジャッジ日時 | 2024-11-25 06:00:20 |
合計ジャッジ時間 | 3,839 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n=gets.to_i s=gets.chomp p2=1 arr=[] ans=[] s.chars{|e| if e=="(" arr<<p2 else p3=arr.pop ans<<[p3,p2] ans<<[p2,p3] end p2+=1 } ans.sort! ans.each{|e| puts e[1] }