結果

問題 No.202 1円玉投げ
ユーザー n_knuun_knuu
提出日時 2015-05-05 00:32:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,334 ms / 5,000 ms
コード長 803 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 95,632 KB
最終ジャッジ日時 2023-08-23 22:25:53
合計ジャッジ時間 37,848 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,297 ms
95,588 KB
testcase_01 AC 1,304 ms
95,324 KB
testcase_02 AC 559 ms
79,980 KB
testcase_03 AC 548 ms
79,980 KB
testcase_04 AC 553 ms
79,892 KB
testcase_05 AC 608 ms
80,900 KB
testcase_06 AC 1,229 ms
91,236 KB
testcase_07 AC 1,300 ms
92,632 KB
testcase_08 AC 1,304 ms
92,656 KB
testcase_09 AC 987 ms
87,608 KB
testcase_10 AC 742 ms
83,264 KB
testcase_11 AC 904 ms
86,196 KB
testcase_12 AC 913 ms
86,488 KB
testcase_13 AC 752 ms
83,732 KB
testcase_14 AC 610 ms
81,144 KB
testcase_15 AC 952 ms
87,240 KB
testcase_16 AC 1,156 ms
95,260 KB
testcase_17 AC 1,216 ms
95,252 KB
testcase_18 AC 1,213 ms
95,280 KB
testcase_19 AC 931 ms
86,784 KB
testcase_20 AC 1,158 ms
90,324 KB
testcase_21 AC 939 ms
86,820 KB
testcase_22 AC 566 ms
79,960 KB
testcase_23 AC 553 ms
80,228 KB
testcase_24 AC 556 ms
80,044 KB
testcase_25 AC 554 ms
80,064 KB
testcase_26 AC 562 ms
80,100 KB
testcase_27 AC 558 ms
80,148 KB
testcase_28 AC 554 ms
79,988 KB
testcase_29 AC 556 ms
79,992 KB
testcase_30 AC 561 ms
80,076 KB
testcase_31 AC 554 ms
80,052 KB
testcase_32 AC 560 ms
79,988 KB
testcase_33 AC 557 ms
79,996 KB
testcase_34 AC 551 ms
80,180 KB
testcase_35 AC 1,229 ms
95,316 KB
testcase_36 AC 1,315 ms
95,504 KB
testcase_37 AC 1,334 ms
93,480 KB
testcase_38 AC 1,271 ms
95,632 KB
testcase_39 AC 554 ms
79,944 KB
testcase_40 AC 539 ms
79,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0