QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#711395 | #7986. 游戏 | szy10010# | WA | 2ms | 5644kb | C++20 | 1.1kb | 2024-11-05 10:28:25 | 2024-11-05 10:28:25 |
Judging History
answer
#include<iostream>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#include<string>
#include<vector>
#include<cstring>
#include<algorithm>
#include<unordered_map>
#define pb push_back
#define fi first
#define se second
#define int long long
#define all(x) (x).begin(),(x).end()
#define _for(i, a) for(int i = 0; i < (a); ++i)
#define _rep(i, a, b) for(int i = (a);i <= (b); ++i)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define u1 (u<<1)
#define u2 (u<<1|1)
//#define endl '\n'
using namespace std;
typedef pair<int,int> PII;
const int INF=0x3f3f3f3f;
const int P=1e9+7;
const int N=1e6+20,M=2*N;
int n,m,k,in[N];
vector<int>v[N];
bool dfs(int u,int fa)
{
int now=0;
for(auto j:v[u])
{
if(j==fa)continue;
if(in[j]==1||dfs(j,u))
now++;
}
return now>=2;
}
void solve(){
cin>>n;
_rep(i,2,n)
{
int a,b;
cin>>a>>b;
v[a].pb(b);
v[b].pb(a);
in[a]++,in[b]++;
}
if(dfs(1,-1)||n==1)cout<<"You win, temporarily.\n";
else cout<<"Wasted.\n";
}
signed main(){
IOS;
int T=1;
// cin>>T;
_rep(i,1,T){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 5640kb
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: 2ms
memory: 5644kb
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: -100
Wrong Answer
time: 1ms
memory: 3588kb
input:
1
output:
You win, temporarily.
result:
wrong answer 1st lines differ - expected: 'Wasted.', found: 'You win, temporarily.'