結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2020-02-01 00:12:27
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,581 bytes
コンパイル時間 1,558 ms
コンパイル使用メモリ 145,692 KB
実行使用メモリ 9,164 KB
最終ジャッジ日時 2024-05-07 20:22:16
合計ジャッジ時間 2,262 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;
using P = pair<int,int>;

vector<int64> bfs(const vector<vector<int64>>& g) {
    int n = g.size();
    vector<bool> visited(n, false);
    vector<int64> visit(n, 0);
    queue<P> q;
    q.emplace(-1,0);
    visit[0]++;

    while(!q.empty()) {
        auto [v, u] = q.front(); q.pop();
        if (visited[u]) continue;
        visited[u] = true;

        for (auto vi : g[u]) {
            if (vi == v) continue;
            visit[vi]++;
            q.emplace(u, vi);
        }
    }
    return visit;
}

int main() {
    int64 n;
    cin >> n;
    vector<vector<int64>> g(n);

    if (n == 2) {
        cout << "Bob" << endl;
        return 0;
    }

    for (int i = 0; i < n - 1; i++) {
        int64 u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    map<int,int> mp;
    for (int i=0; i<n; i++) {
        mp[g[i].size()]++;
    }

    bool ans = false;
    if (mp[0] == 0) ans = true;
    if (mp[0] == 1 && mp[2] == n-1)  ans = true;

    cout << (ans? "Bob" : "Alice") << endl;
}
0