結果
| 問題 | No.592 括弧の対応 (2) |
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2018-03-14 07:10:43 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 736 ms / 5,000 ms |
| コード長 | 176 bytes |
| 記録 | |
| コンパイル時間 | 205 ms |
| コンパイル使用メモリ | 9,216 KB |
| 実行使用メモリ | 32,484 KB |
| 最終ジャッジ日時 | 2026-05-19 16:14:42 |
| 合計ジャッジ時間 | 3,453 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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]
}
horiesiniti