結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー veqccveqcc
提出日時 2020-01-31 22:03:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,001 bytes
コンパイル時間 1,609 ms
コンパイル使用メモリ 109,392 KB
実行使用メモリ 8,768 KB
最終ジャッジ日時 2023-10-17 09:47:59
合計ジャッジ時間 2,354 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 WA -
testcase_14 AC 5 ms
4,348 KB
testcase_15 AC 4 ms
4,348 KB
testcase_16 WA -
testcase_17 AC 5 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 12 ms
4,808 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 40 ms
8,768 KB
testcase_24 AC 41 ms
8,768 KB
testcase_25 AC 43 ms
8,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;

    vector < vector <int> > edge(n);
    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        edge[u].push_back(v);
        edge[v].push_back(u);
    }

    int isolated = 0;
    int have_one_edge = 0;
    for (int i = 0; i < n; i++) {
        if (edge[i].size() == 0) {
            isolated++;
        } else if (edge[i].size() == 1) {
            have_one_edge++;
        }
    }

    if (isolated >= 2 || (isolated == 1 && have_one_edge)) {
        cout << "Alice" << '\n';
    } else {
        cout << "Bob" << '\n';
    }

    return 0;
}
0