結果
| 問題 |
No.3291 K-step Navigation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-12 20:42:39 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 664 bytes |
| コンパイル時間 | 2,849 ms |
| コンパイル使用メモリ | 11,904 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2025-09-12 21:29:43 |
| 合計ジャッジ時間 | 6,036 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge7 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 42 WA * 8 |
ソースコード
def solve():
n, m, k, s, t = list(map(int, input().split()))
s -= 1
t -= 1
s, t = min(s, t), max(s, t)
count = [0] * n
st_connected = False
for _ in range(m):
u, v = list(map(int, input().split()))
u -= 1
v -= 1
u, v = min(u, v), max(u, v)
count[u] += 1
count[v] += 1
if s == u and t == v:
st_connected = True
if (count[s] == 0 and count[t] == 0) or (count[s] == 1 and count[t] == 1 and st_connected):
if k % 2 == 1:
print("Yes")
else:
print("No")
else:
print("Yes")
if __name__ == '__main__':
solve()