QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#779153#7986. 游戏yglWA 1ms3780kbC++20816b2024-11-24 17:41:382024-11-24 17:41:39

Judging History

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

  • [2024-11-24 17:41:39]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3780kb
  • [2024-11-24 17:41:38]
  • 提交

answer

#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;
using i64 = long long;

typedef pair<i64, i64> PII;
constexpr int inf = 0x3f3f3f3f, V = 2000001;

signed main(){
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<vector<int>> e(n);
    for (int i = 0; i < n - 1; i ++ ){
        int u, v;
        cin >> u >> v;
        u --, v --;
        e[u].push_back(v);
    }

    auto dfs = [&](auto self, int u) -> bool{
        if (e[u].empty()){
            return true;
        }
        int cnt = 0;
        for (auto v: e[u]){
            cnt += self(self, v);
        }
        return cnt > 1;
    };

    cout << (dfs(dfs, 0) && n != 1 ? "You win, temporarily" : "Wasted") << "\n";

    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3780kb

input:

6
1 2
2 3
2 4
1 5
5 6

output:

Wasted

result:

wrong answer 1st lines differ - expected: 'Wasted.', found: 'Wasted'