結果

問題 No.202 1円玉投げ
ユーザー nuwasoginuwasogi
提出日時 2015-11-08 03:09:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 4,892 ms / 5,000 ms
コード長 1,090 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 311,936 KB
最終ジャッジ日時 2023-11-27 05:53:34
合計ジャッジ時間 139,992 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4,334 ms
311,936 KB
testcase_01 AC 4,322 ms
311,680 KB
testcase_02 AC 2,448 ms
293,120 KB
testcase_03 AC 2,425 ms
293,120 KB
testcase_04 AC 2,425 ms
293,120 KB
testcase_05 AC 2,563 ms
294,144 KB
testcase_06 AC 4,101 ms
306,816 KB
testcase_07 AC 4,801 ms
308,352 KB
testcase_08 AC 4,892 ms
308,480 KB
testcase_09 AC 3,505 ms
302,080 KB
testcase_10 AC 2,886 ms
297,088 KB
testcase_11 AC 3,371 ms
300,672 KB
testcase_12 AC 3,368 ms
300,800 KB
testcase_13 AC 2,928 ms
297,472 KB
testcase_14 AC 2,574 ms
294,400 KB
testcase_15 AC 3,451 ms
301,824 KB
testcase_16 AC 3,957 ms
311,552 KB
testcase_17 AC 4,115 ms
311,552 KB
testcase_18 AC 4,074 ms
311,552 KB
testcase_19 AC 3,463 ms
301,312 KB
testcase_20 AC 3,996 ms
305,664 KB
testcase_21 AC 3,447 ms
301,312 KB
testcase_22 AC 2,483 ms
293,248 KB
testcase_23 AC 2,471 ms
293,248 KB
testcase_24 AC 2,475 ms
293,120 KB
testcase_25 AC 2,479 ms
293,120 KB
testcase_26 AC 2,487 ms
293,248 KB
testcase_27 AC 2,513 ms
293,248 KB
testcase_28 AC 2,473 ms
293,120 KB
testcase_29 AC 2,483 ms
293,120 KB
testcase_30 AC 2,489 ms
293,248 KB
testcase_31 AC 2,505 ms
293,120 KB
testcase_32 AC 2,493 ms
293,248 KB
testcase_33 AC 2,542 ms
293,120 KB
testcase_34 AC 2,477 ms
293,248 KB
testcase_35 AC 4,297 ms
311,552 KB
testcase_36 AC 4,457 ms
311,936 KB
testcase_37 AC 4,592 ms
309,376 KB
testcase_38 AC 4,288 ms
311,936 KB
testcase_39 AC 2,447 ms
293,120 KB
testcase_40 AC 2,445 ms
293,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Ichiendama:
    Radius = 10
    def __init__(self, x, y):
        self.X = int(x)
        self.Y = int(y)

# 2定距離を返す        
def distance2(a, b):
    return ((a.X - b.X)**2 + (a.Y - b.Y)**2)

# 一円玉a, b が重なっていればtrueを返す
def CheckOverlap(a, b):
    if distance2(a,b) < (Ichiendama.Radius*2)**2:
        return True
    else:
        return False

if __name__ == "__main__":

    N = int(input())
    M = 2001
    ans = 0
    Valids = [[ [] for i in range(M)] for j in range(M)]

    for newcoin in range(N):
        (x, y) = input().split()
        (x, y) = (int(x), int(y))
        newcoin = Ichiendama(x, y)
        isOverlap = False
        nx = x//10
        ny = y//10
        neighbor = []
        for i in range(nx-2,nx+3):
            for j in range(ny-2, ny+3):
                neighbor += Valids[i%M][j%M]
        for v in neighbor:
            if CheckOverlap(v, newcoin):
                isOverlap = True
                break
        if isOverlap == False:
            Valids[nx][ny].append(newcoin)
            ans+=1
    print(ans)
0