QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#377401 | #7986. 游戏 | QXTXY | WA | 33ms | 6484kb | C++14 | 692b | 2024-04-05 13:12:16 | 2024-04-05 13:12:16 |
Judging History
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.'