QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#318582 | #7986. 游戏 | tarjen | WA | 1ms | 3592kb | C++20 | 629b | 2024-01-31 15:34:05 | 2024-01-31 15:34:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+7;
vector<int> G[maxn];
bool ok[maxn];
void dfs(int u,int fa=-1)
{
if(G[u].size()==1&&G[u][0]==fa)
ok[u]=1;
int cnt=0;
for(auto v:G[u])
{
if(v!=fa)
{
dfs(v,u);
cnt+=ok[v];
}
}
if(cnt>=2||(u==1&&cnt==1)) ok[u]=1;
}
int main()
{
int n;
cin>>n;
for(int i=1,u,v;i<n;i++)
{
cin>>u>>v;
G[u].push_back(v);
G[v].push_back(u);
}
dfs(1);
if(ok[1]) cout<<"You win, temporarily.\n";
else cout<<"Wasted.";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3592kb
input:
6 1 2 2 3 2 4 1 5 5 6
output:
You win, temporarily.
result:
wrong answer 1st lines differ - expected: 'Wasted.', found: 'You win, temporarily.'