結果
問題 | No.1265 Balloon Survival |
ユーザー | Coki628 |
提出日時 | 2020-12-05 01:57:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,134 ms / 2,000 ms |
コード長 | 1,247 bytes |
コンパイル時間 | 353 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 148,420 KB |
最終ジャッジ日時 | 2024-09-15 09:54:23 |
合計ジャッジ時間 | 15,477 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
52,736 KB |
testcase_01 | AC | 42 ms
52,736 KB |
testcase_02 | AC | 43 ms
52,736 KB |
testcase_03 | AC | 43 ms
53,248 KB |
testcase_04 | AC | 43 ms
52,992 KB |
testcase_05 | AC | 44 ms
52,992 KB |
testcase_06 | AC | 43 ms
52,992 KB |
testcase_07 | AC | 43 ms
52,736 KB |
testcase_08 | AC | 43 ms
52,864 KB |
testcase_09 | AC | 43 ms
52,736 KB |
testcase_10 | AC | 43 ms
52,480 KB |
testcase_11 | AC | 44 ms
53,248 KB |
testcase_12 | AC | 44 ms
52,864 KB |
testcase_13 | AC | 43 ms
52,736 KB |
testcase_14 | AC | 135 ms
76,416 KB |
testcase_15 | AC | 110 ms
72,576 KB |
testcase_16 | AC | 71 ms
65,664 KB |
testcase_17 | AC | 543 ms
121,088 KB |
testcase_18 | AC | 83 ms
68,480 KB |
testcase_19 | AC | 75 ms
66,304 KB |
testcase_20 | AC | 134 ms
76,288 KB |
testcase_21 | AC | 247 ms
94,720 KB |
testcase_22 | AC | 193 ms
90,624 KB |
testcase_23 | AC | 196 ms
92,544 KB |
testcase_24 | AC | 1,077 ms
147,884 KB |
testcase_25 | AC | 1,061 ms
148,268 KB |
testcase_26 | AC | 1,064 ms
147,892 KB |
testcase_27 | AC | 1,060 ms
148,020 KB |
testcase_28 | AC | 1,084 ms
147,892 KB |
testcase_29 | AC | 1,100 ms
148,268 KB |
testcase_30 | AC | 1,134 ms
148,268 KB |
testcase_31 | AC | 1,088 ms
148,020 KB |
testcase_32 | AC | 1,130 ms
148,100 KB |
testcase_33 | AC | 1,067 ms
148,420 KB |
testcase_34 | AC | 44 ms
53,376 KB |
testcase_35 | AC | 42 ms
52,864 KB |
ソースコード
import sys from operator import itemgetter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for k in range(c)] for j in range(b)] for i in range(a)] def ceil(x, y=1): return int(-(-x // y)) def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)] def Yes(): print('Yes') def No(): print('No') def YES(): print('YES') def NO(): print('NO') sys.setrecursionlimit(10**9) INF = 10**19 MOD = 10**9 + 7 EPS = 10**-10 N = INT() XY = [()] * N for i in range(N): x, y = MAP() XY[i] = (x, y) edges = [] for i, (x, y) in enumerate(XY): for j, (x2, y2) in enumerate(XY[i+1:], i+1): dist = (x-x2)**2 + (y-y2)**2 edges.append((dist, i, j)) edges.sort(key=itemgetter(0)) removed = [0] * N ans = 0 for dist, a, b in edges: if removed[a] or removed[b]: continue if a == 0: ans += 1 removed[b] = 1 elif b == 0: ans += 1 removed[a] = 1 else: removed[a] = 1 removed[b] = 1 print(ans)