結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
n_knuu
|
| 提出日時 | 2015-05-05 00:32:04 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,496 ms / 5,000 ms |
| コード長 | 803 bytes |
| コンパイル時間 | 268 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 98,048 KB |
| 最終ジャッジ日時 | 2024-12-22 08:32:01 |
| 合計ジャッジ時間 | 40,519 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
from math import hypot
N = int(input())
def isOverlap(x1, y1, x2, y2, r=10):
return hypot(x1-x2, y1-y2) < r * 2
def check(x, y):
near = [(-1, -1), (0, -1), (1, -1),
(-1, 0), (0, 0), (1, 0),
(-1, 1), (0, 1), (1, 1)]
for dx, dy in near:
nx = x//20 + dx
ny = y//20 + dy
if 0 <= nx <= 1000 and 0 <= ny <= 1000:
for cx, cy in field[nx][ny]:
# print(x, y, nx, ny, cx, cy, isOverlap(x, y, cx, cy))
if isOverlap(x, y, cx, cy):
return False
return True
field = [[[] for _ in range(1001)] for _ in range(1001)]
ans = 0
for _ in range(N):
x, y = map(int, input().split())
if check(x, y):
ans += 1
field[x//20][y//20].append((x, y))
print(ans)
n_knuu