QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#352279 | #7986. 游戏 | Kevin5307 | WA | 1ms | 3700kb | C++20 | 561b | 2024-03-13 07:49:56 | 2024-03-13 07:49:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
vector<int> G[100100];
int f[100100];
void dfs(int u,int fa)
{
if(G[u].size()==1)
{
f[u]=1;
return ;
}
int cnt=0;
for(auto v:G[u])
if(v!=fa)
{
dfs(v,u);
cnt+=f[v];
}
f[u]=(cnt>1);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
for(int i=1;i<n;i++)
{
int u,v;
cin>>u>>v;
G[u].push_back(v);
G[v].push_back(u);
}
dfs(1,0);
if(f[1])
puts("Wasted.");
else
puts("You win, temporarily.");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3700kb
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.'