結果
問題 | No.479 頂点は要らない |
ユーザー | ckawatak |
提出日時 | 2019-03-24 22:08:44 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 242,048 KB |
最終ジャッジ日時 | 2024-04-15 04:25:25 |
合計ジャッジ時間 | 5,489 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
59,264 KB |
testcase_01 | AC | 42 ms
54,912 KB |
testcase_02 | AC | 116 ms
77,936 KB |
testcase_03 | AC | 40 ms
54,912 KB |
testcase_04 | AC | 38 ms
54,016 KB |
testcase_05 | AC | 40 ms
55,296 KB |
testcase_06 | AC | 40 ms
54,016 KB |
testcase_07 | AC | 43 ms
55,040 KB |
testcase_08 | AC | 40 ms
53,632 KB |
testcase_09 | AC | 39 ms
54,272 KB |
testcase_10 | AC | 41 ms
53,760 KB |
testcase_11 | AC | 40 ms
53,504 KB |
testcase_12 | AC | 39 ms
53,632 KB |
testcase_13 | AC | 47 ms
61,568 KB |
testcase_14 | AC | 169 ms
79,388 KB |
testcase_15 | AC | 159 ms
78,916 KB |
testcase_16 | AC | 157 ms
79,972 KB |
testcase_17 | AC | 158 ms
79,276 KB |
testcase_18 | AC | 133 ms
78,292 KB |
testcase_19 | TLE | - |
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 | -- | - |
ソースコード
from copy import deepcopy N,M = list(map(int, input().split(' '))) G = {} for m in range(M): a,b = list(map(int, input().split(' '))) if a not in G: G[a] = [b] else: G[a].append(b) if b not in G: G[b] = [a] else: G[b].append(a) def remove_edge_on(graph,node): new_graph = deepcopy(graph) for adj in new_graph[node]: new_graph[adj].remove(node) removed_edge = len(new_graph[node]) new_graph[node] = [] return new_graph,removed_edge def solve(graph, i, edge, cost): if edge != M and i == N: return float('inf') if edge == M: return cost new_graph,removed_edge = remove_edge_on(graph, i) return min(solve(graph, i+1, edge, cost), solve(new_graph, i+1, edge+removed_edge, cost+2**i)) print(bin(solve(G,0,0,0))[2:])