結果
問題 |
No.3252 Constrained Moving
|
ユーザー |
|
提出日時 | 2025-09-08 20:47:21 |
言語 | Crystal (1.14.0) |
結果 |
AC
|
実行時間 | 71 ms / 2,000 ms |
コード長 | 289 bytes |
コンパイル時間 | 13,598 ms |
コンパイル使用メモリ | 308,964 KB |
実行使用メモリ | 19,048 KB |
最終ジャッジ日時 | 2025-09-08 20:47:38 |
合計ジャッジ時間 | 16,521 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
n, s, t, k = gets.not_nil!.split.map(&.to_i) s -= 1 t -= 1 arr = Array(Int32).new(n) gets.not_nil!.split.each do |num| arr << num.to_i end if arr[s] + arr[t] <= k puts "1" else mina = arr.min if arr[s] + mina <= k && mina + arr[t] <= k puts "2" else puts "-1" end end