QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#377389 | #7986. 游戏 | QXTXY | WA | 33ms | 5200kb | C++14 | 690b | 2024-04-05 13:03:03 | 2024-04-05 13:03:04 |
Judging History
answer
#include<bits/stdc++.h>
#define MAX 1000000006
using namespace std;
typedef long long ll;
ll as[100005]={0,0},ag[100005]={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";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3776kb
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: 0ms
memory: 3736kb
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: 1ms
memory: 3568kb
input:
1
output:
Wasted.
result:
ok single line: 'Wasted.'
Test #4:
score: -100
Wrong Answer
time: 33ms
memory: 5200kb
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.'