QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#371712#7786. Graft and Transplantcomeintocalm#WA 0ms3796kbC++17362b2024-03-30 15:08:562024-03-30 15:08:57

Judging History

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

  • [2024-03-30 15:08:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3796kb
  • [2024-03-30 15:08:56]
  • 提交

answer

#include <bits/stdc++.h>

int main() {
    int n;
    std::cin >> n;
    std::vector<int> deg(n + 1);
    for (int i = 1; i < n; ++i) {
        int u, v;
        std::cin >> u >> v;
        ++deg[u], ++deg[v];
    }
    int cnt = 0;
    for (int i = 1; i <= n; ++i)
        if (deg[i] > 1)
            ++cnt;
    puts(cnt & 1 ? "Bob" : "Alice");
    return 0;
}

详细

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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