QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#284097#7786. Graft and Transplantiorit#WA 1ms3600kbC++142.2kb2023-12-16 09:18:592023-12-16 09:18:59

Judging History

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

  • [2023-12-16 09:18:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3600kb
  • [2023-12-16 09:18:59]
  • 提交

answer

#include <bits/stdc++.h>
#define _rep(i, x, y) for(int i = x; i <= y; ++i)
#define _req(i, x, y) for(int i = x; i >= y; --i)
#define _rev(i, u) for(int i = head[u]; i; i = e[i].nxt)
#define pb push_back
#define fi first
#define se second
#define mst(f, i) memset(f, i, sizeof f)
using namespace std;
#ifdef ONLINE_JUDGE
#define debug(...) 0
#else
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#endif
namespace fastio{
    #ifdef ONLINE_JUDGE
    char ibuf[50007],*p1 = ibuf, *p2 = ibuf;
    #define get() (p1 == p2 && (p2 = (p1 = ibuf) + fread(ibuf, 1, 50007, stdin), p1 == p2) ? EOF : *p1++)
    #else
    #define get() getchar()
    #endif
    template<typename T> inline void read(T &t){
        T x = 0, f = 1;
        char c = getchar();
        while(!isdigit(c)){
            if(c == '-') f = -f;
            c = getchar();
        }   
        while(isdigit(c)) x = x * 10 + c - '0', c = getchar();
        t = x * f;
    }
    template<typename T, typename ... Args> inline void read(T &t, Args&... args){
        read(t);
        read(args...);
    }
    template<typename T> void write(T t){
        if(t < 0) putchar('-'), t = -t;
        if(t >= 10) write(t / 10);
        putchar(t % 10 + '0');
    }
    template<typename T, typename ... Args> void write(T t, Args... args){
        write(t), putchar(' '), write(args...);
    }
    template<typename T> void writeln(T t){
        write(t);
        puts("");
    }
    template<typename T> void writes(T t){
        write(t), putchar(' ');
    }
    int reads(char *s){
        char c = get(); int len = 0;
        while(!isalpha(c)) c = get();
        while(isalpha(c)) s[++len] = c, c = get();
        return len;
    }
    #undef get
};
using namespace fastio;
#define multitest() int T; read(T); _rep(tCase, 1, T)
typedef long long ll;
typedef pair<int, int> PII;
const int N = 55;
int n, cnt, d[N];
int main(){
    read(n);
    _rep(i, 2, n){
        int u, v; read(u, v);
        d[u]++, d[v]++;
    }
    _rep(i, 1, n) if(d[i] == 1) cnt++;
    int cur = n - 1 - cnt;
    if(cur & 1) puts("Alice");
    else puts("Bob");
    return 0; 	
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3600kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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