QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#302809#7786. Graft and Transplantucup-team173#WA 1ms3552kbC++17715b2024-01-11 13:29:172024-01-11 13:29:17

Judging History

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

  • [2024-01-11 13:29:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3552kb
  • [2024-01-11 13:29:17]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define Mp make_pair
#define SZ(x) (int((x).size()))

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;

void solve() {
    int n;
    cin >> n;
    vi d(n + 1);
    for(int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        d[u]++, d[v]++;
    }
    int cnt = n - 1;
    for(int i = 1; i <= n; i++) if(d[i] == 1) cnt--;
    cout << (cnt % 2 ? "Alice" : "Bob") << '\n';
}
signed main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3536kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3544kb

input:

2
1 2

output:

Alice

result:

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