結果

問題 No.202 1円玉投げ
ユーザー 👑 obakyanobakyan
提出日時 2022-09-20 12:55:12
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 183 ms / 5,000 ms
コード長 1,004 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 12,456 KB
最終ジャッジ日時 2023-08-24 00:25:09
合計ジャッジ時間 4,803 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
11,772 KB
testcase_01 AC 168 ms
12,456 KB
testcase_02 AC 7 ms
4,376 KB
testcase_03 AC 6 ms
4,376 KB
testcase_04 AC 6 ms
4,380 KB
testcase_05 AC 14 ms
4,736 KB
testcase_06 AC 160 ms
10,356 KB
testcase_07 AC 183 ms
10,872 KB
testcase_08 AC 166 ms
11,044 KB
testcase_09 AC 87 ms
8,380 KB
testcase_10 AC 37 ms
6,368 KB
testcase_11 AC 64 ms
7,652 KB
testcase_12 AC 69 ms
7,820 KB
testcase_13 AC 38 ms
6,436 KB
testcase_14 AC 16 ms
5,048 KB
testcase_15 AC 86 ms
8,156 KB
testcase_16 AC 120 ms
11,968 KB
testcase_17 AC 121 ms
11,832 KB
testcase_18 AC 120 ms
11,860 KB
testcase_19 AC 72 ms
8,128 KB
testcase_20 AC 126 ms
9,708 KB
testcase_21 AC 82 ms
8,092 KB
testcase_22 AC 8 ms
4,428 KB
testcase_23 AC 7 ms
4,456 KB
testcase_24 AC 7 ms
4,380 KB
testcase_25 AC 7 ms
4,380 KB
testcase_26 AC 7 ms
4,508 KB
testcase_27 AC 8 ms
4,508 KB
testcase_28 AC 7 ms
4,376 KB
testcase_29 AC 8 ms
4,380 KB
testcase_30 AC 8 ms
4,396 KB
testcase_31 AC 7 ms
4,380 KB
testcase_32 AC 8 ms
4,380 KB
testcase_33 AC 9 ms
4,376 KB
testcase_34 AC 12 ms
4,428 KB
testcase_35 AC 127 ms
11,752 KB
testcase_36 AC 126 ms
11,752 KB
testcase_37 AC 179 ms
11,328 KB
testcase_38 AC 126 ms
11,820 KB
testcase_39 AC 7 ms
4,380 KB
testcase_40 AC 7 ms
4,376 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