結果

問題 No.2674 k-Walk on Bipartite
ユーザー tour2sttour2st
提出日時 2024-03-15 23:16:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,018 bytes
コンパイル時間 983 ms
コンパイル使用メモリ 98,296 KB
実行使用メモリ 16,448 KB
最終ジャッジ日時 2024-03-15 23:16:49
合計ジャッジ時間 4,647 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 4 ms
8,640 KB
testcase_02 AC 4 ms
8,640 KB
testcase_03 AC 4 ms
8,640 KB
testcase_04 AC 4 ms
8,640 KB
testcase_05 AC 4 ms
8,640 KB
testcase_06 AC 4 ms
8,640 KB
testcase_07 AC 117 ms
13,120 KB
testcase_08 WA -
testcase_09 AC 95 ms
12,224 KB
testcase_10 WA -
testcase_11 AC 116 ms
13,248 KB
testcase_12 WA -
testcase_13 AC 87 ms
11,968 KB
testcase_14 WA -
testcase_15 AC 209 ms
16,448 KB
testcase_16 WA -
testcase_17 AC 146 ms
14,400 KB
testcase_18 AC 53 ms
10,816 KB
testcase_19 AC 111 ms
12,480 KB
testcase_20 WA -
testcase_21 AC 168 ms
14,784 KB
testcase_22 AC 222 ms
16,448 KB
testcase_23 AC 5 ms
8,640 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 4 ms
8,640 KB
testcase_27 AC 4 ms
8,640 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 4 ms
8,640 KB
testcase_31 AC 4 ms
8,640 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 4 ms
8,640 KB
testcase_35 WA -
testcase_36 AC 4 ms
8,640 KB
testcase_37 AC 4 ms
8,640 KB
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <random>
#include <time.h>
#include <map>
using namespace std;

int n,m,s,t,k,a,b;
vector<int>e[200000];
int length[200000];
bool visited[200000];

void dfs(int now, int len=0)
{
    if(visited[now]) return;
    visited[now]=true;
    length[now]=len;
    for(int nxt:e[now]) dfs(nxt, len+1);
}

int main()
{
    cin >> n >> m >> s >> t >> k;
    for(int i=0;i<m;i++)
    {
        cin >> a >> b;
        a--;b--;
        e[a].push_back(b);
        e[b].push_back(a);
    }
    s--;t--;
    dfs(s);
    if(visited[t])
    {
        if(length[t]%2!=k%2)
        {
            cout << "No" << endl;
        }
        else
        {
            if(length[t]<=k)
            {
                cout << "No" << endl;
            }
            else
            {
                cout << "Unknown" << endl;
            }
        }
    }
    else
    {
        cout << "Unknown" << endl;
    }
}
0