結果

問題 No.3291 K-step Navigation
ユーザー Iroha_3856
提出日時 2025-10-03 21:27:54
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,349 bytes
コンパイル時間 4,798 ms
コンパイル使用メモリ 335,040 KB
実行使用メモリ 7,840 KB
最終ジャッジ日時 2025-10-03 21:28:11
合計ジャッジ時間 6,442 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = atcoder::modint998244353;
// using mint = double;

#define rep(i, l, r) for (int i = (int)(l); i<(int)(r); i++)
#define ll long long
#define ld long double
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define siz(x) (int)(x).size()

template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const int inf = 1e9;
const ll INF = 4e18;

template<class T> using pq = priority_queue<T, vector<T>, less<T>>;
template<class T> using spq = priority_queue<T, vector<T>, greater<T>>;

vector<int> di = {0, 0, 1, -1};
vector<int> dj = {1, -1, 0, 0};

struct Edge {
    int to, cost;
};

void solve() {
    int N, M, S, T; ll K; cin >> N >> M >> K >> S >> T;
    vector<int> deg(N, 0);
    rep(i, 0, M) {
        int u, v; cin >> u >> v;
        u--; v--;
        deg[u]++; deg[v]++;
    }
    if (K%2) {
        cout << "Yes" << endl;
    }
    else {
        if (deg[S] or deg[T]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int T = 1;
    // cin >> T;
    while(T--) {
        solve();
    }
}
0