結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-04 18:29:22 |
| 言語 | Python2 (2.7.18) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,585 bytes |
| コンパイル時間 | 164 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 26,392 KB |
| 最終ジャッジ日時 | 2024-12-22 10:42:39 |
| 合計ジャッジ時間 | 7,235 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 RE * 37 |
ソースコード
N = input()
inputs = [map(int,raw_input().split(" ")) for i in range(N)]
class AABB:
def __init__(self):
pass
def marge(ab1,ab2):
ret = AABB()
ret.left = min(ab1.left,ab2.left)
ret.right = max(ab1.right,ab2.right)
ret.up = min(ab1.up,ab2.up)
ret.down = max(ab1.down,ab2.down)
ret.children = [ab1,ab2]
def nyrn(self,x,y):
self.left = x - 10
self.right = x + 10
self.up = y - 10
self.down = y + 10
self.x = x
self.y = y
self.children = -1
def search(self,cx,cy):
if cx+10 > self.left and cx-10 < self.right:
if cy-10<self.down and cy+10 > self.up:
if self.children == -1:
return (self.x-cx)**2+(self.y-cy)**2 < 400
else:
for c in children:
if c.search(cx,cy):
return True
aabb = AABB()
aabb.nyrn(inputs[0][0],inputs[0][1])
ans = 1
nyrns = [[] for i in range(17)]
nyrns[0].append(aabb)
for x,y in inputs[1:]:
flag = False
for i in range(17):
for c in nyrns[i]:
if c.search(x,y):
flag = True
if flag:
pass
else:
ans+=1
new_aabb = AABB()
new_aabb.nyrn(x,y)
nyrns[0].append(new_aabb)
for i in range(17):
if len(nyrns[i] )>2:
xx = nyrns[i].pop(0)
yy = nyrns[i].pop(0)
zz = AABB.marge(xx,yy)
nyrns[i+1].append(zz)
print ans