結果

問題 No.202 1円玉投げ
ユーザー Tawara
提出日時 2015-08-04 23:22:08
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 409 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 6,784 KB
実行使用メモリ 333,356 KB
最終ジャッジ日時 2024-12-22 09:48:40
合計ジャッジ時間 171,790 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 TLE * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def dfs(cx,cy,hx,hy):
	ones.add((hx,hy))
	for i in range(4):
		nx = hx + dx[i]; ny = hy + dy[i]
		if (nx,ny) not in ones and (cx-nx)**2 + (cy-ny)**2 < 400:
			dfs(cx,cy,nx,ny)
dx = (1,0,-1,0)
dy = (0,1,0,-1)
sys.setrecursionlimit(10000000)
ones = set()
N = int(raw_input())
ans = 0
for i in range(N):
	x,y = map(int,raw_input().split(" "))
	if (x,y) not in ones:
		ans += 1
		dfs(x,y,x,y)
print ans
0