QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691094#7786. Graft and Transplantxxk2006WA 0ms3668kbC++231011b2024-10-31 09:49:172024-10-31 09:50:13

Judging History

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

  • [2024-10-31 09:50:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3668kb
  • [2024-10-31 09:49:17]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define Enter putchar('\n')
#define spc putchar(' ')
#define pb push_back
#define fi first
#define se second
inline void read(int &num){num=0;int f=1;char ch=getchar();while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){num=(num<<1)+(num<<3)+(ch^48);ch=getchar();}num*=f;}
inline void lread(long long &num){num=0;int f=1;char ch=getchar();while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){num=(num<<1)+(num<<3)+(ch^48);ch=getchar();}num*=f;}
void print(long long num){if(num<0){putchar('-');num=-num;}if(num>9){print(num/10);}putchar((num%10)^48);}
int d[59];
int main(){
    int n,u,v;
    read(n);
    for(int i=1;i<n;i++){
        read(u),read(v);
        ++d[u],++d[v];
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(d[i]>1)++ans;
    }
    if(ans&1){
        puts("Bob");
    }
    else puts("Alice");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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