QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#377329 | #7986. 游戏 | Gevin# | WA | 22ms | 10532kb | C++14 | 2.0kb | 2024-04-05 12:32:43 | 2024-04-05 12:32:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 998244353;
inline ll Norm(ll x){return (x % MOD + MOD) % MOD;}
inline ll Add(ll u, ll v){return Norm(Norm(u) + Norm(v));} //加
inline ll Sub(ll u, ll v){return Norm(Norm(u) - Norm(v));} //减
inline ll Mul(ll u, ll v){return Norm(Norm(u) * Norm(v));} //乘
ll Ksm(ll x, ll e) //快速幂
{
ll res = 1;
x = Norm(x);
while (e)
{
if (e & 1)
res = Mul(res, x);
x = Mul(x, x);
e >>= 1;
}
return res;
}
inline ll Inv(ll x){return Ksm(x, MOD - 2);}//逆元
inline ll Div(ll u, ll v){return Mul(u, Inv(v));}
void Ex_gcd(ll a,ll b,ll &x,ll &y) //拓展欧几里得
{
if(!b)
{
x=1;
y=0;
return;
}
Ex_gcd(b,a%b,x,y);
ll k = x;
x = y;
y=k - a/b*y;
}
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int nn=2e5+10;
ll n,x,y;
vector<ll> v[100005];
bool key = 0;
ll sum[100005];
ll dp[100005];
void dfs(ll x,ll fa){
if(v[x].size() == 1){
sum[x] = 1;
return;
}
for(auto it : v[x]){
if(it == fa) continue;
dfs(it, x);
sum[x] += sum[it];
}
if(x == 1) return;
if(sum[x] >= 2) sum[x] = 1;
else sum[x] = 0;
}
int main()
{
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin>>n;
for(int i=1;i<n;++i){
cin>>x>>y;
v[x].push_back(y);
v[y].push_back(x);
}
dfs(1,0);
if(sum[1] >= 2) cout<<"You win, temporarily.";
else cout<<"Wasted.";
return 0;
}
/*
cout<<fixed<<setprecision(5)<<a;
// へ /|
// /\7 ∠_/
// / │ / /
// │ Z _,< / /`ヽ
// │ ヽ / 〉
// Y ` / /
// ?● ? ● ??〈 /
// () へ | \〈
// >? ?_ ィ │ //
// / へ / ?<| \\
// ヽ_? (_/ │//
// 7 |/
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5916kb
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: 0ms
memory: 5964kb
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: 5912kb
input:
1
output:
Wasted.
result:
ok single line: 'Wasted.'
Test #4:
score: 0
Accepted
time: 17ms
memory: 10532kb
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: 0
Accepted
time: 22ms
memory: 10420kb
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:
Wasted.
result:
ok single line: 'Wasted.'
Test #6:
score: 0
Accepted
time: 21ms
memory: 10468kb
input:
100000 40385 1 28939 40385 71739 28939 66436 71739 29540 66436 79210 29540 60766 29540 68309 66436 69492 68309 21819 68309 57705 71739 33098 57705 54050 33098 19349 33098 98912 33098 20261 57705 72108 71739 49433 72108 87548 49433 78576 49433 29257 49433 39468 72108 44720 39468 87329 39468 82036 721...
output:
You win, temporarily.
result:
ok single line: 'You win, temporarily.'
Test #7:
score: 0
Accepted
time: 21ms
memory: 10464kb
input:
100000 56256 1 19611 56256 63814 19611 13211 63814 40727 13211 15422 13211 41472 63814 61111 41472 41205 41472 7343 41472 4246 63814 61460 4246 47333 61460 6130 61460 76912 4246 95893 63814 4861 95893 32371 95893 53124 95893 87414 63814 83500 63814 89982 83500 26326 89982 50802 89982 15280 89982 584...
output:
Wasted.
result:
ok single line: 'Wasted.'
Test #8:
score: 0
Accepted
time: 16ms
memory: 10424kb
input:
100000 53790 1 72385 53790 72398 72385 89902 72398 52488 89902 46763 89902 33914 72398 31021 33914 7197 33914 6377 72398 67336 6377 81807 6377 28285 72398 66168 28285 72743 28285 78065 72398 51875 78065 50576 78065 91812 72398 91740 91812 31634 91812 47708 72398 63776 47708 95702 47708 43401 47708 6...
output:
You win, temporarily.
result:
ok single line: 'You win, temporarily.'
Test #9:
score: -100
Wrong Answer
time: 1ms
memory: 5916kb
input:
2 2 1
output:
Wasted.
result:
wrong answer 1st lines differ - expected: 'You win, temporarily.', found: 'Wasted.'