結果

問題 No.202 1円玉投げ
ユーザー niyarinniyarin
提出日時 2016-10-04 18:29:22
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 1,585 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 6,624 KB
実行使用メモリ 25,900 KB
最終ジャッジ日時 2023-08-23 23:28:18
合計ジャッジ時間 7,201 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 11 ms
5,980 KB
testcase_03 AC 11 ms
5,980 KB
testcase_04 AC 11 ms
6,052 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 17 ms
6,256 KB
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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  
0