QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#280071#7786. Graft and Transplantucup-team1516#WA 0ms3876kbC++17994b2023-12-09 13:43:022023-12-09 13:43:04

Judging History

你现在查看的是最新测评结果

  • [2023-12-09 13:43:04]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3876kb
  • [2023-12-09 13:43:02]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}
inline double time() {
    return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    vector<vector<int>> g(n);
    for (int i = 0; i < n-1; ++i) {
        int x,y; cin >> x >> y;
        x -= 1;
        y -= 1;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    vector<int> d(n);
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        d[i] = g[i].size();
        if (d[i] > 1) cnt += 1;
    }
    if (cnt%2 == 0) {
        cout << "Alice" << endl;
    }
    else {
        cout << "Bob" << endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3876kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3648kb

input:

2
1 2

output:

Alice

result:

wrong answer 1st words differ - expected: 'Bob', found: 'Alice'