QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#377431 | #7986. 游戏 | QXTXY | WA | 33ms | 6020kb | C++17 | 766b | 2024-04-05 13:31:20 | 2024-04-05 13:31:20 |
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},ak[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]]++;
}
ak[as[i]]++;
}
ll f=1;
for(i=n-1;i>=1;i--)
{
if(ag[i]>=2)
{
s.push(i);
}
if(ak[i]!=1)
{
f=0;
}
}
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((f&&n!=1)||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: 0ms
memory: 3588kb
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: 3544kb
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: 3548kb
input:
1
output:
Wasted.
result:
ok single line: 'Wasted.'
Test #4:
score: -100
Wrong Answer
time: 33ms
memory: 6020kb
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.'