結果

問題 No.1882 Areas of Triangle
ユーザー 👑 obakyanobakyan
提出日時 2022-03-22 21:58:13
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-18 22:46:09
合計ジャッジ時間 1,783 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 159 ms
6,944 KB
testcase_05 AC 181 ms
6,940 KB
testcase_06 AC 151 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 3 ms
6,944 KB
testcase_18 AC 5 ms
6,940 KB
testcase_19 AC 16 ms
6,944 KB
testcase_20 AC 16 ms
6,944 KB
testcase_21 AC 16 ms
6,940 KB
testcase_22 AC 16 ms
6,944 KB
testcase_23 AC 47 ms
6,940 KB
testcase_24 AC 50 ms
6,944 KB
testcase_25 AC 1 ms
6,944 KB
testcase_26 AC 2 ms
6,944 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
long long atoll(const char*);
]]

local function lltonumber(str)
  return C.atoll(str)
end

local n, k = io.read():match("(%d+) (%d+)")
n = tonumber(n)
k = lltonumber(k)
k = k * 2LL
local t = {}
for i = 1, n do
  t[i] = 1LL * io.read("*n")
end
table.sort(t)
local ret = 0
local pos = n + 1
for i = 1, n do
  while 1 < pos and k <= t[pos - 1] * t[i] do
    pos = pos - 1
  end
  ret = ret + n + 1 - pos
end
print(ret)
0