QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#360935 | #4896. Alice、Bob 与 DFS | dengtingyu | 0 | 2ms | 7872kb | C++20 | 814b | 2024-03-22 16:16:22 | 2024-03-22 16:16:23 |
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200100
ll n;
ll val[N];ll col[N];
vector<ll>e[N];
int main(){
// freopen("test1.in","r",stdin);
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n;for(int i=1;i<=n;i++)cin>>col[i];for(int i=1;i<=n;i++){ll x;cin>>x;for(int j=1,u;j<=x;j++)cin>>u,e[i].push_back(u);}
ll k;cin>>k;for(int i=1,x;i<=k;i++)cin>>x;for(int i=n;i>=1;i--){
val[i]=3;if(col[i]){
for(auto o:e[i]){
if(val[i]<=2)break;
if(val[i]==3)val[i]=val[o];
else val[i]=((val[o]-1)^1)+1;
}
}else{
for(auto o:e[i])if(val[o]==2||val[o]==3)val[i]=1;
}
}if(val[1]==1||val[1]==4)cout<<"Alice";
else cout<<"Bob";return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 2ms
memory: 7872kb
input:
1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
Alice
result:
ok "Alice"
Test #2:
score: -5
Wrong Answer
time: 2ms
memory: 7844kb
input:
1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'
Subtask #2:
score: 0
Wrong Answer
Test #18:
score: 15
Accepted
time: 1ms
memory: 7792kb
input:
7 0 0 1 1 0 1 1 1 2 2 3 4 0 2 5 6 0 1 7 0 1 1
output:
Bob
result:
ok "Bob"
Test #19:
score: -15
Wrong Answer
time: 1ms
memory: 7768kb
input:
6 0 1 0 0 1 0 2 2 6 3 3 4 5 0 0 0 0 1 1
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'
Subtask #3:
score: 0
Wrong Answer
Test #55:
score: 15
Accepted
time: 1ms
memory: 5780kb
input:
7 0 0 1 1 0 1 1 1 2 2 3 4 0 2 5 6 0 1 7 0 1 1
output:
Bob
result:
ok "Bob"
Test #56:
score: -15
Wrong Answer
time: 1ms
memory: 5668kb
input:
6 0 1 0 0 1 0 2 2 6 3 3 4 5 0 0 0 0 1 1
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'
Subtask #4:
score: 0
Wrong Answer
Test #103:
score: 0
Wrong Answer
time: 1ms
memory: 5744kb
input:
10 1 1 1 1 1 1 1 1 1 1 1 2 4 3 5 7 8 1 4 0 1 6 0 0 1 9 1 10 0 1 1
output:
Bob
result:
wrong answer 1st words differ - expected: 'Alice', found: 'Bob'
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%