結果

問題 No.647 明太子
ユーザー gemmarogemmaro
提出日時 2020-02-14 10:26:26
言語 Ruby
(3.3.0)
結果
MLE  
実行時間 -
コード長 589 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 418,048 KB
最終ジャッジ日時 2024-04-16 00:09:13
合計ジャッジ時間 17,086 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 95 ms
12,288 KB
testcase_02 AC 93 ms
12,160 KB
testcase_03 AC 94 ms
12,288 KB
testcase_04 AC 97 ms
12,160 KB
testcase_05 AC 93 ms
12,288 KB
testcase_06 AC 95 ms
12,032 KB
testcase_07 AC 96 ms
12,416 KB
testcase_08 AC 97 ms
12,160 KB
testcase_09 AC 137 ms
14,848 KB
testcase_10 AC 193 ms
17,536 KB
testcase_11 AC 128 ms
12,928 KB
testcase_12 AC 165 ms
16,384 KB
testcase_13 AC 253 ms
23,680 KB
testcase_14 AC 1,743 ms
128,704 KB
testcase_15 AC 338 ms
29,184 KB
testcase_16 AC 170 ms
15,872 KB
testcase_17 AC 2,169 ms
157,228 KB
testcase_18 AC 2,362 ms
171,392 KB
testcase_19 AC 783 ms
78,208 KB
testcase_20 AC 824 ms
83,584 KB
testcase_21 AC 355 ms
38,016 KB
testcase_22 MLE -
testcase_23 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

MEMBERS = gets.to_i.times.map { gets.chomp.split.map(&:to_i) }
FOODS = gets.to_i.times.map { gets.chomp.split.map(&:to_i) }

FOODS_WITH_NUM = MEMBERS.map do |value, hot|
  FOODS.map.with_index do |food, index|
    index if food[0] <= value && food[1] >= hot
  end
end.flatten.compact.sort.group_by(&:itself).map { |i, j| [i, j.size] }

MAXS = FOODS_WITH_NUM.filter do |_, j|
  j == (FOODS_WITH_NUM.max_by { |_, k| k } || [nil, 0])[1]
end

if MAXS.empty?
  puts 0
  exit
end

puts(MAXS.map { |k, _v| k + 1 }
         .uniq
         .sort
         .join("\n"))
0