QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#303496#7786. Graft and TransplantPetroTarnavskyi#WA 1ms3476kbC++20768b2024-01-12 17:16:552024-01-12 17:16:56

Judging History

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

  • [2024-01-12 17:16:56]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3476kb
  • [2024-01-12 17:16:55]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;


int main()
{
	ios::sync_with_stdio(0); 
	cin.tie(0);
	cout << fixed << setprecision(15);
	
	int n;
	cin >> n;
	VI cnt(n, 0);
	FOR(i, 0, 2 * (n - 1))
	{
		int a;
		cin >> a;
		cnt[a - 1]++;
	}
	int res = 0;
	FOR(i, 0, n)
		if(cnt[i] > 1)
			res++;
	
	if(res % 2 == 0)
		cout << "Alice\n";
	else
		cout << "Bob\n";
	
	
	return 0;
}

詳細信息

Test #1:

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

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: 1ms
memory: 3476kb

input:

2
1 2

output:

Alice

result:

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