結果

問題 No.647 明太子
ユーザー Takuya NoguchiTakuya Noguchi
提出日時 2018-03-08 22:39:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,123 ms / 4,500 ms
コード長 597 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 11,548 KB
実行使用メモリ 71,216 KB
最終ジャッジ日時 2023-09-09 09:41:25
合計ジャッジ時間 6,776 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,032 KB
testcase_01 AC 80 ms
15,132 KB
testcase_02 AC 75 ms
15,244 KB
testcase_03 AC 76 ms
15,212 KB
testcase_04 AC 76 ms
15,304 KB
testcase_05 AC 76 ms
15,164 KB
testcase_06 AC 76 ms
15,308 KB
testcase_07 AC 77 ms
15,228 KB
testcase_08 AC 76 ms
15,156 KB
testcase_09 AC 88 ms
16,052 KB
testcase_10 AC 100 ms
16,936 KB
testcase_11 AC 82 ms
15,544 KB
testcase_12 AC 95 ms
16,480 KB
testcase_13 AC 117 ms
17,664 KB
testcase_14 AC 514 ms
27,368 KB
testcase_15 AC 138 ms
18,428 KB
testcase_16 AC 92 ms
16,464 KB
testcase_17 AC 627 ms
26,880 KB
testcase_18 AC 670 ms
28,504 KB
testcase_19 AC 281 ms
16,732 KB
testcase_20 AC 293 ms
17,080 KB
testcase_21 AC 156 ms
16,624 KB
testcase_22 AC 1,123 ms
71,216 KB
testcase_23 AC 79 ms
15,100 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

select_price_and_flavor = []
gets.to_i.times do
  select_price_and_flavor << gets.split.map(&:to_i)
end

each_price_and_flavor = []
gets.to_i.times do
  each_price_and_flavor << gets.split.map(&:to_i)
end

mentaiko_index_and_num = each_price_and_flavor.map.with_index(1) { |(x, y), i|
  [
    i,
    select_price_and_flavor.select { |a, b|
      x <= a && b <= y
    }.size
  ]
}.sort_by { |i, num| [-num, i] }

max_mentaiko_num = mentaiko_index_and_num.first[1]
if max_mentaiko_num.zero?
  puts 0
  exit
end

puts mentaiko_index_and_num.select { |_, num|
  num == max_mentaiko_num
}.map(&:first)
0