QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#764519#7786. Graft and TransplantfosovWA 0ms3652kbC++14744b2024-11-20 09:34:032024-11-20 09:34:06

Judging History

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

  • [2024-11-20 09:34:06]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3652kb
  • [2024-11-20 09:34:03]
  • 提交

answer

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

#define ll long long 
#define lll __int128
#define INF 0x3f3f3f3f
#define LNF 0x3f3f3f3f3f3f3f3fll
#define MOD 998244353
#define pii pair<int, int>
#define ld long double
#define fi first
#define se second
#define all(a) a.begin(), a.end()

#define N 110

int deg[N];

int main() {
#ifdef TEST
    freopen("zz.in", "r+", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

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

    int k = -1;
    for (int i = 1; i <= n; ++ i) k += deg[i] != 1;
    
    cout << (k%2?"Alice":"Bob") << '\n';
}   

// 3 3
// 2 2

詳細信息

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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