QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#318582#7986. 游戏tarjenWA 1ms3592kbC++20629b2024-01-31 15:34:052024-01-31 15:34:06

Judging History

你现在查看的是最新测评结果

  • [2024-01-31 15:34:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3592kb
  • [2024-01-31 15:34:05]
  • 提交

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.'