QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#609765#7786. Graft and Transplantwzxtsl#WA 0ms3684kbC++23864b2024-10-04 13:56:552024-10-04 13:56:55

Judging History

This is the latest submission verdict.

  • [2024-10-04 13:56:55]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3684kb
  • [2024-10-04 13:56:55]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define For(i,j,k) for (int i=(j);i<=(k);i++)
#define rof(i,j,k) for (int i=(j);i>=(k);i--)
#define ull unsigned long long
#define lowbit(x) ((x)&(-(x)))
#define PII pair<int,int>
#define int long long
#define endl "\n"
#define ls rt<<1
#define rs rt<<1|1
typedef long long ll;
const int mod = 998244353;
const double eps = 1e-9;
const int N=2e6+7;
int n,m;
void solve(){
	cin>>n;
    int a[n+1]={0};
    int sor[n+1]={0};
    for(int i=1;i<n;i++){
        int u,v;
        cin>>u>>v;
        a[u]++;
        a[v]++;

    }
   int cnt=0;
    For(i,1,n)
        if(a[i]>=2) cnt++;
    if(cnt&1)    cout<<"Bob"<<endl;
    else cout<<"Alice"<<endl;
	
}
signed main(){
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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