結果
問題 | No.1722 [Cherry 3rd Tune C] In my way |
ユーザー |
![]() |
提出日時 | 2021-11-14 00:20:48 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 84 ms / 2,000 ms |
コード長 | 312 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-11-28 08:23:44 |
合計ジャッジ時間 | 3,330 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
コンパイルメッセージ
Syntax OK
ソースコード
N, M = gets.split.map(&:to_i) X = gets.split.map.with_index { |x, i| [x.to_i, i] }.sort_by(&:first) Y = gets.split.map(&:to_i).sort ans = Array.new(N) X.each do |x, idx| while Y.size > 0 && Y[0] < x Y.shift end if Y.empty? ans[idx] = 'Infinity' else ans[idx] = Y[0] - x end end puts ans