結果

問題 No.592 括弧の対応 (2)
ユーザー Tsuneo YoshiokaTsuneo Yoshioka
提出日時 2017-11-10 23:29:34
言語 Ruby
(3.3.0)
結果
AC  
実行時間 322 ms / 5,000 ms
コード長 222 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 11,240 KB
実行使用メモリ 18,104 KB
最終ジャッジ日時 2023-08-16 05:28:55
合計ジャッジ時間 2,091 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,304 KB
testcase_01 AC 322 ms
17,620 KB
testcase_02 AC 319 ms
18,104 KB
testcase_03 AC 321 ms
17,520 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N=gets.to_i
st=[]
corr=[]
gets.chomp.each_char.with_index{|c, i|
    if c=='('
        st.push(i)
    else
        j = st.pop()
        corr[j] = i;
        corr[i] = j;
    end
}
corr.each_with_index{|v, i|
    puts v+1
}
0