結果

問題 No.989 N×Mマス計算(K以上)
ユーザー shi-moshi-mo
提出日時 2020-09-30 00:23:41
言語 Ruby
(3.3.0)
結果
AC  
実行時間 503 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 11,436 KB
実行使用メモリ 24,572 KB
最終ジャッジ日時 2023-09-18 02:47:47
合計ジャッジ時間 5,917 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,256 KB
testcase_01 AC 86 ms
15,220 KB
testcase_02 AC 85 ms
15,160 KB
testcase_03 AC 84 ms
15,104 KB
testcase_04 AC 84 ms
15,080 KB
testcase_05 AC 87 ms
15,120 KB
testcase_06 AC 89 ms
15,036 KB
testcase_07 AC 88 ms
15,152 KB
testcase_08 AC 84 ms
15,104 KB
testcase_09 AC 84 ms
15,120 KB
testcase_10 AC 384 ms
21,136 KB
testcase_11 AC 230 ms
22,908 KB
testcase_12 AC 377 ms
21,628 KB
testcase_13 AC 155 ms
20,532 KB
testcase_14 AC 503 ms
24,572 KB
testcase_15 AC 203 ms
17,052 KB
testcase_16 AC 333 ms
19,504 KB
testcase_17 AC 144 ms
20,460 KB
testcase_18 AC 326 ms
16,304 KB
testcase_19 AC 250 ms
23,368 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, m, k = gets.split.map(&:to_i)
op, *b = gets.chomp.split
b.map!(&:to_i)
a = []
n.times{ a << gets.to_i }

b.sort!
op = op.to_sym

c = 0
n.times do |i|
  x, y = 0, m
  while 0 < (y - x)
    p = (x+y) / 2
    if k <= [a[i], b[p]].inject(op)
      y = p
      next
    end
    x = p+1
  end
  c += m - x
end
puts c
0