結果

問題 No.202 1円玉投げ
コンテスト
ユーザー しらっ亭
提出日時 2015-06-26 01:51:12
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 722 ms / 5,000 ms
コード長 759 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 211 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 350,108 KB
最終ジャッジ日時 2026-05-28 17:15:48
合計ジャッジ時間 14,120 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict


def lap(bin, x, y, dx, dy):

    cs = []
    for xx in [-1, 0, 1]:
        for yy in [-1, 0, 1]:
            cs.extend(bin[dx + xx, dy + yy])

    for bx, by in cs:
        if (bx - x) ** 2 + (by - y) ** 2 < 400:
            return True

    for xx in [-1, 0, 1]:
        for yy in [-1, 0, 1]:
            bin[dx + xx, dy + yy].append((x, y))

    return False


def solve(XY):
    bin = defaultdict(list)

    count = 0
    for x, y in XY:
        dx = x // 10
        dy = y // 10
        if not lap(bin, x, y, dx, dy):
            count += 1

    return count


def main():
    N = int(input())
    XY = [list(map(int, input().split())) for i in range(N)]

    print(solve(XY))


if __name__ == '__main__':
    main()
0