結果
問題 | No.871 かえるのうた |
ユーザー | kept1994 |
提出日時 | 2021-08-31 18:52:01 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,009 bytes |
コンパイル時間 | 183 ms |
コンパイル使用メモリ | 10,796 KB |
実行使用メモリ | 816,752 KB |
最終ジャッジ日時 | 2023-08-17 07:39:02 |
合計ジャッジ時間 | 5,940 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 19 ms
8,496 KB |
testcase_01 | AC | 19 ms
8,572 KB |
testcase_02 | AC | 19 ms
8,636 KB |
testcase_03 | AC | 19 ms
8,636 KB |
testcase_04 | AC | 19 ms
8,524 KB |
testcase_05 | AC | 19 ms
8,564 KB |
testcase_06 | AC | 19 ms
8,492 KB |
testcase_07 | AC | 19 ms
8,536 KB |
testcase_08 | AC | 27 ms
10,044 KB |
testcase_09 | AC | 30 ms
10,672 KB |
testcase_10 | AC | 23 ms
9,340 KB |
testcase_11 | AC | 22 ms
8,840 KB |
testcase_12 | AC | 76 ms
19,876 KB |
testcase_13 | AC | 32 ms
11,112 KB |
testcase_14 | AC | 254 ms
33,336 KB |
testcase_15 | AC | 280 ms
47,128 KB |
testcase_16 | MLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
ソースコード
#!/usr/bin/env python3 import sys def main(): from collections import deque INF = 10 ** 16 def bfs(edges: "List[to]", start_node: int) -> list: q = deque() dist = [INF] * len(edges) q.append(start_node) dist[start_node] = 0 while q: now = q.popleft() for next in edges[now]: if dist[next] != INF: continue q.append(next) dist[next] = dist[now] + 1 return dist import bisect N, K = map(int, input().split()) X = list(map(int, input().split())) A = list(map(int, input().split())) G = [[] for _ in range(N)] for i in range(N): l = bisect.bisect_left(X, X[i] - A[i]) r = bisect.bisect_right(X, X[i] + A[i]) for j in range(l, r): if i == j: continue G[i].append(j) d = bfs(G, K - 1) print(N - d.count(INF)) return if __name__ == '__main__': main()