QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#624765 | #7986. 游戏 | JYYMVP | WA | 40ms | 9112kb | C++14 | 968b | 2024-10-09 16:35:24 | 2024-10-09 16:35:25 |
Judging History
answer
#include<bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define abs(a) (a > 0 ? (a) : -(a))
static ll max(ll a, ll b) { return a > b ? a : b; }
static ll min(ll a, ll b) { return a < b ? a : b; }
using namespace std;
const int N = 1e5 + 9;
vector<int> adj[100005];
int d[100005];
bool dfs(int node) {
int s = 0;
for (int i = 0; i < adj[node].size(); i++)
{
s += dfs(adj[node][i]);
}
if (adj[node].size()==0)return 1;
if (s >= 2) {
return 1;
}
else return 0;
}
int main() {
int n;
cin >> n;
for (int i = 0; i < n - 1; ++i) {
int u, v;
cin >> u >> v;
adj[u].push_back(v);
}
if (n == 1) {
cout << "Wasted." << endl;
return 0;
}
if (dfs(1)) {
cout << "You win, temporarily." << endl;
}
else {
cout << "Wasted." << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 5912kb
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: 6112kb
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: 5992kb
input:
1
output:
Wasted.
result:
ok single line: 'Wasted.'
Test #4:
score: 0
Accepted
time: 40ms
memory: 9112kb
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: 38ms
memory: 9108kb
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.'