QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#712404#7786. Graft and TransplantSoestxWA 0ms3676kbC++23680b2024-11-05 15:34:572024-11-05 15:34:57

Judging History

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

  • [2024-11-05 15:34:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3676kb
  • [2024-11-05 15:34:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pll pair<int,int>
#define fi first
#define se second
typedef long long LL;
typedef unsigned long long ull;
int n, m, k;
const int N = 1e5 + 10, M = 1e5, mod = 998244353;
int num[N], book[N];
int  res, cnt;


void solve() {
	cin>>n;
	for(int i=1;i<n;i++)
	{
		int a,b;
		cin>>a>>b;
		num[a]++,num[b]++;
		if(num[a]==2) res++;
		if(num[b]==2) res++;
	}
	if(res&1) cout<<"Bob\n";
	else cout<<"Alice\n";
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	//cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}
/*

*/

Details

Tip: Click on the bar to expand more detailed information

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: 3584kb

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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