結果

問題 No.647 明太子
ユーザー gemmarogemmaro
提出日時 2020-02-14 10:51:34
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 697 bytes
コンパイル時間 46 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 334,336 KB
最終ジャッジ日時 2024-04-16 00:11:43
合計ジャッジ時間 15,553 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
12,032 KB
testcase_01 AC 91 ms
12,160 KB
testcase_02 AC 91 ms
12,288 KB
testcase_03 AC 91 ms
12,032 KB
testcase_04 AC 90 ms
12,032 KB
testcase_05 AC 91 ms
12,032 KB
testcase_06 AC 92 ms
12,288 KB
testcase_07 AC 91 ms
12,288 KB
testcase_08 AC 90 ms
12,160 KB
testcase_09 AC 128 ms
14,976 KB
testcase_10 AC 167 ms
17,408 KB
testcase_11 AC 107 ms
12,928 KB
testcase_12 AC 151 ms
16,000 KB
testcase_13 AC 232 ms
23,680 KB
testcase_14 AC 1,629 ms
127,232 KB
testcase_15 AC 297 ms
29,184 KB
testcase_16 AC 143 ms
15,744 KB
testcase_17 AC 2,005 ms
156,672 KB
testcase_18 AC 2,159 ms
171,392 KB
testcase_19 AC 786 ms
78,208 KB
testcase_20 AC 831 ms
83,328 KB
testcase_21 AC 358 ms
37,888 KB
testcase_22 TLE -
testcase_23 AC 93 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

class Array
  def accepts
    FOODS.map.with_index do |food, index|
      index if food[0] <= self[0] && food[1] >= self[1]
    end
  end
end

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(&:accepts)
                        .flatten
                        .compact
                        .group_by(&:itself)
                        .map { |i, j| [i, j.size] }

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

puts(if MAXS.empty?
       0
     else
       MAXS.map { |k, _v| k + 1 }.uniq
     end)
0