結果
問題 | No.1898 Battle and Exchange |
ユーザー | polylogK |
提出日時 | 2021-12-23 17:45:22 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,665 bytes |
コンパイル時間 | 325 ms |
コンパイル使用メモリ | 82,160 KB |
実行使用メモリ | 222,888 KB |
最終ジャッジ日時 | 2024-09-22 05:48:19 |
合計ジャッジ時間 | 40,774 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
53,604 KB |
testcase_01 | AC | 39 ms
54,600 KB |
testcase_02 | AC | 39 ms
53,148 KB |
testcase_03 | WA | - |
testcase_04 | AC | 59 ms
66,292 KB |
testcase_05 | AC | 65 ms
68,392 KB |
testcase_06 | AC | 112 ms
77,012 KB |
testcase_07 | WA | - |
testcase_08 | AC | 77 ms
74,020 KB |
testcase_09 | AC | 171 ms
78,768 KB |
testcase_10 | AC | 40 ms
54,976 KB |
testcase_11 | AC | 53 ms
64,872 KB |
testcase_12 | AC | 74 ms
74,024 KB |
testcase_13 | AC | 39 ms
54,920 KB |
testcase_14 | AC | 77 ms
74,620 KB |
testcase_15 | AC | 39 ms
53,388 KB |
testcase_16 | AC | 80 ms
74,720 KB |
testcase_17 | AC | 189 ms
79,404 KB |
testcase_18 | AC | 395 ms
89,036 KB |
testcase_19 | AC | 649 ms
94,096 KB |
testcase_20 | AC | 422 ms
94,088 KB |
testcase_21 | AC | 1,142 ms
114,792 KB |
testcase_22 | AC | 55 ms
65,420 KB |
testcase_23 | AC | 63 ms
66,348 KB |
testcase_24 | AC | 75 ms
73,988 KB |
testcase_25 | AC | 103 ms
76,592 KB |
testcase_26 | AC | 42 ms
54,052 KB |
testcase_27 | AC | 110 ms
77,500 KB |
testcase_28 | AC | 115 ms
77,636 KB |
testcase_29 | AC | 128 ms
78,272 KB |
testcase_30 | AC | 105 ms
77,252 KB |
testcase_31 | AC | 53 ms
63,372 KB |
testcase_32 | AC | 451 ms
92,420 KB |
testcase_33 | AC | 851 ms
105,456 KB |
testcase_34 | AC | 367 ms
88,592 KB |
testcase_35 | AC | 545 ms
96,960 KB |
testcase_36 | WA | - |
testcase_37 | AC | 287 ms
85,328 KB |
testcase_38 | AC | 3,884 ms
222,888 KB |
testcase_39 | AC | 1,233 ms
161,772 KB |
testcase_40 | AC | 2,760 ms
186,616 KB |
testcase_41 | AC | 1,023 ms
153,004 KB |
testcase_42 | AC | 203 ms
79,280 KB |
testcase_43 | AC | 637 ms
115,188 KB |
testcase_44 | AC | 64 ms
69,748 KB |
testcase_45 | AC | 265 ms
81,472 KB |
testcase_46 | AC | 669 ms
93,692 KB |
testcase_47 | AC | 203 ms
79,520 KB |
testcase_48 | AC | 219 ms
82,736 KB |
testcase_49 | AC | 136 ms
77,572 KB |
testcase_50 | AC | 139 ms
77,764 KB |
testcase_51 | AC | 128 ms
77,740 KB |
testcase_52 | AC | 128 ms
77,472 KB |
testcase_53 | AC | 231 ms
81,700 KB |
testcase_54 | AC | 230 ms
82,104 KB |
testcase_55 | AC | 383 ms
85,936 KB |
testcase_56 | AC | 271 ms
84,692 KB |
testcase_57 | AC | 3,010 ms
128,304 KB |
testcase_58 | AC | 1,978 ms
125,832 KB |
testcase_59 | AC | 1,873 ms
128,628 KB |
testcase_60 | AC | 1,890 ms
126,272 KB |
ソースコード
import heapq def solve(n, m, graph, abc): for i in range(n): abc[i].sort(reverse=True) def check(x): # A = x, B = 1, C = 1で突破できる? myabc = [x, 1, 1] q = [] good = [False] * n visit = [False] * n if sum(abc[0]) >= sum(myabc): return False myabc[1] = abc[0][0] good[0] = True visit[0] = True for to in graph[0]: visit[to] = True heapq.heappush(q, (sum(abc[to]), to)) while q: nowsum, now = heapq.heappop(q) if nowsum < sum(myabc): good[now] = True if now == n - 1: return True else: return False myabc.sort(reverse=True) myabc[1] = max(myabc[1], abc[0][1]) myabc[2] = max(myabc[2], abc[0][0]) myabc[1] = max(myabc[1], abc[now][1]) myabc[2] = max(myabc[2], abc[now][0]) for to in graph[now]: if not visit[to]: visit[to] = True heapq.heappush(q, (sum(abc[to]), to)) return good[n - 1] ok, ng = 3 * 10 ** 8, 1 while abs(ok - ng) > 1: mid = (ok + ng) // 2 if check(mid): ok = mid else: ng = mid return ok, 1, 1 n, m = map(int, input().split()) graph = [[] for _ in range(n)] for _ in range(m): u, v = map(int, input().split()) u -= 1 v -= 1 graph[u].append(v) graph[v].append(u) abc = [list(map(int, input().split())) for _ in range(n)] a, b, c = solve(n, m, graph, abc) print(a, b, c)