結果

問題 No.202 1円玉投げ
ユーザー 👑 obakyanobakyan
提出日時 2022-04-03 22:49:26
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 230 ms / 5,000 ms
コード長 1,004 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 5,292 KB
実行使用メモリ 12,360 KB
最終ジャッジ日時 2023-08-24 00:23:51
合計ジャッジ時間 5,182 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
11,684 KB
testcase_01 AC 190 ms
12,360 KB
testcase_02 AC 7 ms
4,376 KB
testcase_03 AC 6 ms
4,376 KB
testcase_04 AC 7 ms
4,376 KB
testcase_05 AC 15 ms
4,824 KB
testcase_06 AC 182 ms
10,336 KB
testcase_07 AC 218 ms
10,852 KB
testcase_08 AC 218 ms
11,036 KB
testcase_09 AC 100 ms
8,368 KB
testcase_10 AC 40 ms
6,268 KB
testcase_11 AC 80 ms
7,644 KB
testcase_12 AC 82 ms
7,824 KB
testcase_13 AC 47 ms
6,380 KB
testcase_14 AC 16 ms
4,964 KB
testcase_15 AC 101 ms
8,232 KB
testcase_16 AC 124 ms
11,820 KB
testcase_17 AC 123 ms
11,816 KB
testcase_18 AC 123 ms
11,756 KB
testcase_19 AC 90 ms
8,068 KB
testcase_20 AC 163 ms
9,824 KB
testcase_21 AC 89 ms
7,912 KB
testcase_22 AC 8 ms
4,380 KB
testcase_23 AC 8 ms
4,500 KB
testcase_24 AC 8 ms
4,376 KB
testcase_25 AC 7 ms
4,380 KB
testcase_26 AC 8 ms
4,504 KB
testcase_27 AC 7 ms
4,376 KB
testcase_28 AC 8 ms
4,384 KB
testcase_29 AC 7 ms
4,384 KB
testcase_30 AC 8 ms
4,380 KB
testcase_31 AC 8 ms
4,376 KB
testcase_32 AC 8 ms
4,440 KB
testcase_33 AC 9 ms
4,392 KB
testcase_34 AC 12 ms
4,420 KB
testcase_35 AC 130 ms
11,736 KB
testcase_36 AC 130 ms
11,760 KB
testcase_37 AC 230 ms
11,336 KB
testcase_38 AC 130 ms
11,848 KB
testcase_39 AC 7 ms
4,376 KB
testcase_40 AC 8 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local mmi, mma = math.min, math.max
local mfl, mce = math.floor, math.ceil
local mesh = 100
local lim = 201
local t = {}
for i = 1, lim do
  t[i] = {}
  for j = 1, lim do
    t[i][j] = {}
  end
end
local function inner(a, b, c, d)
  return (a - c) * (a - c) + (b - d) * (b - d) < 400
end
local n = io.read("*n")
for _i = 1, n do
  local a, b = io.read("*n", "*n")
  a = a + 1
  b = b + 1
  local ap = mce(a / mesh)
  local bp = mce(b / mesh)
  local imin = mma(1, ap - 1)
  local imax = mmi(lim, ap + 1)
  local jmin = mma(1, bp - 1)
  local jmax = mmi(lim, bp + 1)
  local found = false
  for i = imin, imax do for j = jmin, jmax do
    local tbl = t[i][j]
    for k = 1, #tbl do
      local c, d = tbl[k][1], tbl[k][2]
      if inner(a, b, c, d) then found = true break end
    end
    if found then break end
  end if found then break end end
  if not found then
    table.insert(t[ap][bp], {a, b})
  end
end
local ret = 0
for i = 1, lim do for j = 1, lim do
  ret = ret + #t[i][j]
end end
print(ret)
0