QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#679223#7786. Graft and Transplantsurenjamts#WA 0ms3700kbC++17513b2024-10-26 17:10:122024-10-26 17:10:12

Judging History

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

  • [2024-10-26 17:10:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3700kb
  • [2024-10-26 17:10:12]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define F first
#define S second
vector <int> adj[247];
signed main(){
	int n, a, b;
	cin >> n;
	for(int i = 1; i < n; i ++ ){
		cin >> a >> b;
		adj[a].pb( b );
		adj[b].pb( a );
	}
	int leaf = 0;
	for(int i = 1; i <= n; i ++ ){
		if( adj[i].size() == 1 )
			leaf ++;
	}
	if( n != 4 ){
		cout << "Alice\n";
		return 0;
	}
	if( (n-leaf)%2 == 0 ){
		cout << "Alice\n";
	}else
		cout << "Bob\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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