結果
問題 | No.94 圏外です。(EASY) |
ユーザー | Navier_Boltzmann |
提出日時 | 2023-07-23 01:56:00 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 92 ms / 5,000 ms |
コード長 | 1,811 bytes |
コンパイル時間 | 148 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 77,488 KB |
最終ジャッジ日時 | 2024-09-23 01:08:13 |
合計ジャッジ時間 | 2,587 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 48 ms
56,024 KB |
testcase_01 | AC | 46 ms
55,896 KB |
testcase_02 | AC | 46 ms
57,128 KB |
testcase_03 | AC | 46 ms
56,296 KB |
testcase_04 | AC | 52 ms
63,652 KB |
testcase_05 | AC | 54 ms
64,676 KB |
testcase_06 | AC | 58 ms
65,372 KB |
testcase_07 | AC | 64 ms
68,788 KB |
testcase_08 | AC | 73 ms
72,084 KB |
testcase_09 | AC | 79 ms
73,912 KB |
testcase_10 | AC | 79 ms
74,088 KB |
testcase_11 | AC | 82 ms
74,116 KB |
testcase_12 | AC | 79 ms
73,984 KB |
testcase_13 | AC | 78 ms
73,796 KB |
testcase_14 | AC | 79 ms
75,020 KB |
testcase_15 | AC | 81 ms
75,068 KB |
testcase_16 | AC | 87 ms
77,124 KB |
testcase_17 | AC | 92 ms
77,488 KB |
testcase_18 | AC | 91 ms
77,120 KB |
testcase_19 | AC | 91 ms
77,080 KB |
testcase_20 | AC | 48 ms
56,504 KB |
testcase_21 | AC | 46 ms
56,184 KB |
ソースコード
from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline class DSU: def __init__(self, n): self._n = n self.parent_or_size = [-1] * n def merge(self, a, b): assert 0 <= a < self._n assert 0 <= b < self._n x, y = self.leader(a), self.leader(b) if x == y: return x if -self.parent_or_size[x] < -self.parent_or_size[y]: x, y = y, x self.parent_or_size[x] += self.parent_or_size[y] self.parent_or_size[y] = x return x def same(self, a, b): assert 0 <= a < self._n assert 0 <= b < self._n return self.leader(a) == self.leader(b) def leader(self, a): assert 0 <= a < self._n if self.parent_or_size[a] < 0: return a self.parent_or_size[a] = self.leader(self.parent_or_size[a]) return self.parent_or_size[a] def size(self, a): assert 0 <= a < self._n return -self.parent_or_size[self.leader(a)] def groups(self): leader_buf = [self.leader(i) for i in range(self._n)] result = [[] for _ in range(self._n)] for i in range(self._n): result[leader_buf[i]].append(i) return [r for r in result if r != []] N = int(input()) X = [tuple(map(int,input().split())) for _ in range(N)] D = DSU(N) for i in range(N-1): xi,yi = X[i] for j in range(i+1,N): xj,yj = X[j] if (xi-xj)**2 + (yi-yj)**2 <= 100: D.merge(i,j) ans = 2 if N==0: print(1) exit() for g in D.groups(): n = len(g) for i in range(n-1): xi,yi = X[g[i]] for j in range(i+1,n): xj,yj = X[g[j]] tmp = math.sqrt((xi-xj)**2 + (yi-yj)**2) ans = max(ans,tmp+2) print(ans)