結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-04 00:05:07 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,403 ms / 5,000 ms |
| コード長 | 990 bytes |
| コンパイル時間 | 272 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 47,812 KB |
| 最終ジャッジ日時 | 2024-12-22 06:45:18 |
| 合計ジャッジ時間 | 20,388 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
import collections
def read_data():
N = int(input())
XY = []
for i in range(N):
x, y = map(int, input().split())
XY.append((x, y))
return N, XY
def solve(N, XY, r = 10, size = 50):
cells = collections.defaultdict(list)
count = 0
threshold = 4 * r * r
for x, y in XY:
if not overlap(x, y, cells, size, threshold):
count += 1
register_cell(x, y, cells, size)
return count
def overlap(x, y, cells, size, threshold):
xc = x // size
yc = y // size
for xr in [xc-1, xc, xc+1]:
for yr in [yc-1, yc, yc+1]:
if (xr, yr) in cells:
for xx, yy in cells[xr, yr]:
if (x - xx) ** 2 + (y - yy) ** 2 < threshold:
return True
return False
def register_cell(x, y, cells, size):
xc = x // size
yc = y // size
cells[xc, yc].append((x, y))
if __name__ == "__main__":
N, XY = read_data()
print(solve(N, XY))