QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#377401#7986. 游戏QXTXYWA 33ms6484kbC++14692b2024-04-05 13:12:162024-04-05 13:12:16

Judging History

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

  • [2024-04-05 13:12:16]
  • 评测
  • 测评结果:WA
  • 用时:33ms
  • 内存:6484kb
  • [2024-04-05 13:12:16]
  • 提交

answer

#include<bits/stdc++.h>
#define MAX 1000000006
using namespace std;
typedef long long ll;
ll as[1000005]={0,0},ag[1000005]={0};
queue<ll>s;
int main()
{
	ll n,i,a,b;
	cin>>n;
	for(i=1;i<=n-1;i++)
	{
		cin>>a>>b;
		if(a>b)
		{
			as[a]=b;
		}
		else
		{
			as[b]=a;
		}
	}
	for(i=n;i>=1;i--)
	{
		if(ag[i]==0)
		{
			ag[as[i]]++;
		}
	}
	for(i=n-1;i>=1;i--)
	{
		if(ag[i]>=2)
		{
			s.push(i);
		}
		
	}
	while(s.size())
	{
		ag[as[s.front()]]++;
		if(ag[as[s.front()]]==2&&as[s.front()]!=1)
		{
			s.push(as[s.front()]);
		}
		s.pop();
	}
	if(n==2||ag[1]>=2)
	{
		cout<<"You win, temporarily.\n";
	}
	else
	{
		cout<<"Wasted.\n";
	}
}


詳細信息

Test #1:

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

input:

6
1 2
2 3
2 4
1 5
5 6

output:

Wasted.

result:

ok single line: 'Wasted.'

Test #2:

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

input:

7
1 2
2 3
2 4
1 5
5 6
5 7

output:

You win, temporarily.

result:

ok single line: 'You win, temporarily.'

Test #3:

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

input:

1

output:

Wasted.

result:

ok single line: 'Wasted.'

Test #4:

score: -100
Wrong Answer
time: 33ms
memory: 6484kb

input:

100000
86389 1
68115 86389
27661 68115
9669 27661
7343 9669
59420 7343
98078 59420
39321 98078
14847 39321
76863 14847
21104 14847
24241 39321
82708 39321
73282 82708
7424 39321
64358 7424
81481 39321
17105 81481
74205 17105
81202 98078
63636 81202
62429 63636
85827 62429
8648 62429
67963 63636
7287...

output:

Wasted.

result:

wrong answer 1st lines differ - expected: 'You win, temporarily.', found: 'Wasted.'