QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#692418#7786. Graft and Transplantblhxzjr#WA 0ms3648kbC++23539b2024-10-31 14:29:032024-10-31 14:29:31

Judging History

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

  • [2024-10-31 14:29:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-10-31 14:29:03]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N =60;
int n,m;
vector<int> g[N]; 
void solve() {
	cin >> n;
	for (int i = 1; i < n; i++) {
		int u,v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
		
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int x = g[i].size();
		ans += (x == 1) ? 1 : 0;
	}
	ans = n - ans;
	cout << ((ans % 2) ? "Bob" : "Alice") << endl;
}
signed main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	int T = 1;
	while (T--) {
		solve();
	} 
	return 0;
}

详细

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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