結果

問題 No.1577 織姫と彦星2
ユーザー 👑 rin204rin204
提出日時 2022-03-23 14:53:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 92,036 KB
最終ジャッジ日時 2024-04-19 20:50:26
合計ジャッジ時間 6,028 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,120 KB
testcase_01 AC 38 ms
53,504 KB
testcase_02 AC 38 ms
53,760 KB
testcase_03 AC 37 ms
53,120 KB
testcase_04 AC 38 ms
53,120 KB
testcase_05 AC 43 ms
63,232 KB
testcase_06 AC 39 ms
60,032 KB
testcase_07 AC 120 ms
84,480 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 49 ms
67,200 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 41 ms
59,520 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 63 ms
76,928 KB
testcase_28 WA -
testcase_29 AC 60 ms
71,040 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 46 ms
62,336 KB
testcase_33 AC 43 ms
61,824 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 61 ms
72,576 KB
testcase_43 AC 60 ms
73,088 KB
testcase_44 AC 50 ms
62,976 KB
testcase_45 WA -
testcase_46 AC 48 ms
66,688 KB
testcase_47 AC 65 ms
78,592 KB
testcase_48 WA -
testcase_49 AC 72 ms
72,960 KB
testcase_50 AC 58 ms
69,376 KB
testcase_51 AC 41 ms
62,592 KB
testcase_52 WA -
testcase_53 AC 102 ms
87,040 KB
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 AC 52 ms
65,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n = int(input())
s, e = map(int, input().split())
stone = set(map(int, input().split()))
stone.add(e)
dist = {s:0}
queue = deque()
queue.append(s)
while queue:
    pos = queue.pop()
    for i in range(30):
        npos = pos ^ (1 << i)
        if npos not in dist and npos in stone:
            dist[npos] = dist[pos] + 1
            queue.append(npos)

print(dist.get(e, 0) - 1)
0