結果
| 問題 |
No.22 括弧の対応
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-21 17:52:44 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 314 bytes |
| コンパイル時間 | 397 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,928 KB |
| 最終ジャッジ日時 | 2024-06-24 19:35:55 |
| 合計ジャッジ時間 | 2,809 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 15 |
コンパイルメッセージ
Syntax OK
ソースコード
_, K = gets.split.map(&:to_i)
S = gets.chomp
start_paren_index = 0
paren_table = {}
S.chars.each.with_index(1) do |paren, i|
if paren == '('
start_paren_index += 1
else
paren_table[start_paren_index] = i
paren_table[i] = start_paren_index
start_paren_index -= 1
end
end
puts paren_table[K]