QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#360960#4896. Alice、Bob 与 DFSdengtingyu0 1ms7832kbC++20861b2024-03-22 16:31:562024-03-22 16:31:57

Judging History

你现在查看的是最新测评结果

  • [2024-03-22 16:31:57]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:7832kb
  • [2024-03-22 16:31:56]
  • 提交

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]==4)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;
        }
    }//for(int i=1;i<=n;i++)cout<<val[i]<<' ';
    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: 0
Wrong Answer
time: 0ms
memory: 5764kb

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:

Bob

result:

wrong answer 1st words differ - expected: 'Alice', found: 'Bob'

Subtask #2:

score: 0
Wrong Answer

Test #18:

score: 15
Accepted
time: 1ms
memory: 7764kb

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: 0
Accepted
time: 0ms
memory: 7792kb

input:

6
0 1 0 0 1 0
2 2 6
3 3 4 5
0
0
0
0
1
1

output:

Bob

result:

ok "Bob"

Test #20:

score: 0
Accepted
time: 1ms
memory: 5740kb

input:

3
0 1 0
1 2
1 3
0
1
1

output:

Bob

result:

ok "Bob"

Test #21:

score: -15
Wrong Answer
time: 1ms
memory: 7828kb

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 #3:

score: 0
Wrong Answer

Test #55:

score: 15
Accepted
time: 1ms
memory: 5728kb

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: 0
Accepted
time: 1ms
memory: 7704kb

input:

6
0 1 0 0 1 0
2 2 6
3 3 4 5
0
0
0
0
1
1

output:

Bob

result:

ok "Bob"

Test #57:

score: 0
Accepted
time: 1ms
memory: 7768kb

input:

3
0 1 0
1 2
1 3
0
1
1

output:

Bob

result:

ok "Bob"

Test #58:

score: -15
Wrong Answer
time: 0ms
memory: 7832kb

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 #4:

score: 0
Wrong Answer

Test #103:

score: 0
Wrong Answer
time: 1ms
memory: 5720kb

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%