結果
問題 | No.1190 Points |
ユーザー | AndrewK |
提出日時 | 2020-08-01 11:31:24 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,363 bytes |
コンパイル時間 | 615 ms |
コンパイル使用メモリ | 10,748 KB |
実行使用メモリ | 56,628 KB |
最終ジャッジ日時 | 2023-09-22 04:00:54 |
合計ジャッジ時間 | 41,870 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 24 ms
9,156 KB |
testcase_01 | AC | 24 ms
9,060 KB |
testcase_02 | AC | 24 ms
9,176 KB |
testcase_03 | AC | 1,167 ms
37,024 KB |
testcase_04 | AC | 1,050 ms
33,848 KB |
testcase_05 | AC | 936 ms
32,692 KB |
testcase_06 | AC | 1,566 ms
43,604 KB |
testcase_07 | AC | 1,687 ms
47,868 KB |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | AC | 1,790 ms
36,308 KB |
testcase_12 | TLE | - |
testcase_13 | AC | 1,556 ms
32,200 KB |
testcase_14 | AC | 311 ms
30,424 KB |
testcase_15 | TLE | - |
testcase_16 | AC | 254 ms
16,256 KB |
testcase_17 | TLE | - |
testcase_18 | AC | 1,039 ms
23,776 KB |
testcase_19 | AC | 376 ms
36,960 KB |
testcase_20 | AC | 1,389 ms
28,944 KB |
testcase_21 | AC | 547 ms
26,032 KB |
testcase_22 | AC | 486 ms
39,088 KB |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | AC | 1,641 ms
48,116 KB |
testcase_26 | AC | 698 ms
45,596 KB |
testcase_27 | AC | 1,621 ms
48,356 KB |
ソースコード
import heapq import queue inf = 3 * (10 ** 18) n, m, p = map(int, input().split()) s, g = map(int, input().split()) road = [[0 for j in range(0)] for i in range(n + 1)] kyo_s = [[inf for j in range(2)] for i in range(n + 1)] kyo_g = [[inf for j in range(2)] for i in range(n + 1)] kyo_s[s][0] = 0 kyo_g[g][0] = 0 ans = [] for _ in range(m): u, v = map(int, input().split()) road[u].append(v) road[v].append(u) q = queue.Queue() q.put([0, s]) while q.empty() == False: k = q.get() cnt = k[0] x = k[1] if kyo_s[x][cnt % 2] < cnt: continue cnt += 1 for i in road[x]: if kyo_s[i][cnt % 2] > cnt: q.put([cnt, i]) kyo_s[i][cnt % 2] = cnt q.put([0, g]) while q.empty() == False: k = q.get() cnt = k[0] x = k[1] if kyo_g[x][cnt % 2] < cnt: continue cnt += 1 for i in road[x]: if kyo_g[i][cnt % 2] > cnt: q.put([cnt, i]) kyo_g[i][cnt % 2] = cnt for i in range(1, n+1): if p % 2: odd = min(kyo_s[i][0] + kyo_g[i][1], kyo_s[i][1] + kyo_g[i][0]) if odd <= p: ans.append(i) else: even = min(kyo_s[i][0] + kyo_g[i][0], kyo_s[i][1] + kyo_g[i][1]) if even <= p: ans.append(i) if (len(ans) == 0): print(-1) else: print(len(ans)) for i in ans: print(i)