QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#779159 | #7986. 游戏 | ygl | WA | 23ms | 8640kb | C++20 | 818b | 2024-11-24 17:42:43 | 2024-11-24 17:42:43 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3828kb
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: 3780kb
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: 1ms
memory: 3612kb
input:
1
output:
Wasted.
result:
ok single line: 'Wasted.'
Test #4:
score: 0
Accepted
time: 14ms
memory: 8568kb
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:
You win, temporarily.
result:
ok single line: 'You win, temporarily.'
Test #5:
score: -100
Wrong Answer
time: 23ms
memory: 8640kb
input:
100000 28424 1 91124 28424 70268 91124 99456 70268 80696 99456 72802 80696 69700 72802 77527 72802 3835 80696 83715 3835 6690 3835 63240 3835 87789 80696 29903 99456 21234 29903 92544 21234 87569 21234 67361 29903 18146 67361 22916 67361 7024 99456 62805 7024 24624 7024 37895 7024 29126 99456 13746 ...
output:
You win, temporarily.
result:
wrong answer 1st lines differ - expected: 'Wasted.', found: 'You win, temporarily.'