QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#183095#4896. Alice、Bob 与 DFShos_lyric20 676ms34512kbC++144.5kb2023-09-18 23:08:422023-09-18 23:08:42

Judging History

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

  • [2023-09-18 23:08:42]
  • 评测
  • 测评结果:20
  • 用时:676ms
  • 内存:34512kb
  • [2023-09-18 23:08:42]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
template <class T> using rbtree = __gnu_pbds::tree<
  T,
  __gnu_pbds::null_type,
  std::less<T>,
  __gnu_pbds::rb_tree_tag,
  __gnu_pbds::tree_order_statistics_node_update
>;


int N;
vector<int> C;
vector<int> deg;
vector<vector<int>> graph;
int K;
vector<int> R;


namespace brute {
// state: just determined to call dfs(stack.back().first)
map<vector<pair<int, int>>, int> cache;
int calc(const vector<pair<int, int>> &stack) {
  auto it = cache.find(stack);
  if (it != cache.end()) return it->second;
  
  set<int> app;
  for (auto ujs = stack; ; ujs.pop_back()) {
    if (ujs.empty()) {
      app.insert(0);
      goto done;
    }
    const int u = ujs.back().first;
    for (int &j = ujs.back().second; ++j < deg[u]; ) {
      auto vjs = ujs;
      vjs.emplace_back(graph[u][j], -1);
      app.insert(calc(vjs));
      if (!C[u]) {
        goto done;
      }
    }
  }
 done:{}
  int ret;
  for (ret = 0; app.count(ret); ++ret) {}
#ifdef LOCAL
cerr<<"calc "<<stack<<" = "<<ret<<endl;
#endif
  
  return cache[stack] = ret;
}
int run() {
  cache.clear();
  int ans = 0;
  for (const int r : R) {
    ans ^= calc({make_pair(r, -1)});
  }
  return ans;
}
}  // brute


namespace fast {
// dp[u][p]: now at u,  p = {transition with returning} \subseteq {0, 1}
int dp[200'010][1 << 2];
int run() {
  vector<int> fs(N), gs(N);
  for (int u = N; --u >= 0; ) {
    for (int p = 0; p < 1 << 2; ++p) {
      if (C[u] || !deg[u]) {
        int q = p;
        rbtree<int> unapp;
        for (int x = 2; x <= deg[u] + 2; ++x) {
          unapp.insert(x);
        }
        for (int j = deg[u]; --j >= 0; ) {
          const int v = graph[u][j];
          const int g = dp[v][q];
          if (g < 2) {
            q |= 1 << g;
          } else {
            // (g-2)-th excludant
            auto it = unapp.find_by_order(q);
            if (it != unapp.end()) {
              unapp.erase(it);
            }
          }
        }
        dp[u][p] = (!(q & 1 << 0)) ? 0 : (!(q & 1 << 1)) ? 1 : *unapp.begin();
      } else {
        int q = p;
        for (int j = deg[u]; --j >= 0; ) {
          const int v = graph[u][j];
          const int g = dp[v][q];
          q = (g < 2) ? (1 << g) : 0;
        }
        dp[u][p] = (!(q & 1 << 0)) ? 0 : (!(q & 1 << 1)) ? 1 : -1;
      }
    }
// cerr<<"dp["<<u<<"] = ";pv(dp[u],dp[u]+4);
  }
  int ans = 0;
  for (const int r : R) {
    ans ^= dp[r][1 << 0];
  }
  return ans;
}
}  // sub5


int main() {
  for (; ~scanf("%d", &N); ) {
    C.resize(N);
    for (int u = 0; u < N; ++u) {
      scanf("%d", &C[u]);
    }
    deg.resize(N);
    graph.resize(N);
    for (int u = 0; u < N; ++u) {
      scanf("%d", &deg[u]);
      graph[u].resize(deg[u]);
      for (int j = 0; j < deg[u]; ++j) {
        scanf("%d", &graph[u][j]);
        --graph[u][j];
      }
    }
    scanf("%d", &K);
    R.resize(K);
    for (int k = 0; k < K; ++k) {
      scanf("%d", &R[k]);
      --R[k];
    }
    
    const int ans = fast::run();
    puts(ans ? "Alice" : "Bob");
#ifdef LOCAL
const int brt=brute::run();
assert(brt==ans);
cerr<<"========"<<endl;
#endif
  }
  return 0;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 3620kb

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

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:

ok "Bob"

Test #3:

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

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

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

10
0 0 0 0 0 0 0 0 0 0
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
0
1
1

output:

Bob

result:

ok "Bob"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

11
0 0 0 0 0 0 0 0 0 0 0
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
0
0
2
1 11

output:

Alice

result:

ok "Alice"

Test #6:

score: 0
Accepted
time: 38ms
memory: 20424kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

ok "Bob"

Test #7:

score: 0
Accepted
time: 33ms
memory: 20412kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

ok "Bob"

Test #8:

score: 0
Accepted
time: 79ms
memory: 19460kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 #9:

score: 0
Accepted
time: 81ms
memory: 19460kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

ok "Bob"

Test #10:

score: 0
Accepted
time: 77ms
memory: 19356kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

ok "Bob"

Test #11:

score: 0
Accepted
time: 76ms
memory: 18628kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

ok "Bob"

Test #12:

score: 0
Accepted
time: 71ms
memory: 18528kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

ok "Bob"

Test #13:

score: 0
Accepted
time: 73ms
memory: 18608kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 #14:

score: 0
Accepted
time: 55ms
memory: 17948kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

ok "Bob"

Test #15:

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

input:

1
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #16:

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

input:

3
0 0 0
1 2
1 3
0
1
1

output:

Alice

result:

ok "Alice"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

4
0 0 0 0
1 2
1 3
0
0
2
1 4

output:

Bob

result:

ok "Bob"

Subtask #2:

score: 15
Accepted

Test #18:

score: 15
Accepted
time: 0ms
memory: 3576kb

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: 3636kb

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: 0ms
memory: 3640kb

input:

3
0 1 0
1 2
1 3
0
1
1

output:

Bob

result:

ok "Bob"

Test #21:

score: 0
Accepted
time: 0ms
memory: 3656kb

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:

Alice

result:

ok "Alice"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

10
1 0 0 1 1 1 0 0 1 0
2 2 3
0
1 4
1 5
1 6
3 7 9 10
1 8
0
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

10
1 1 1 1 1 1 1 1 1 1
4 2 3 4 10
0
0
1 5
1 6
2 7 8
0
1 9
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #24:

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

input:

52
0 0 1 0 1 0 1 0 0 0 1 1 1 1 1 0 0 1 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 1 1 1 0 0 1 0 1 1 1 1 0 0 0 0 0 1 0
1 2
2 3 4
0
3 5 6 8
0
1 7
0
2 9 48
2 10 11
0
1 12
2 13 14
0
1 15
1 16
3 17 42 47
4 18 22 33 41
1 19
2 20 21
0
0
3 23 24 26
0
1 25
0
1 27
2 28 31
1 29
1 30
0
1 32
0
1 34
3 35 37 38
1 36
0
0
1 39...

output:

Bob

result:

ok "Bob"

Test #25:

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

input:

98
0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 1 1 1 0 0 1 0 1 1 0 0 1 0 0 1 0 1 1 1 1 0 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 1 1 1 1 1 0 1 0 0 1 0 0 0 1 1 0
1 2
1 3
1 4
4 5 6 11 12
0
1 7
2 8 9
0
1 10
0
0
1 13
1 14
2 15 54
11 16 17 18 41 42 45 46 47 50 52 53
...

output:

Bob

result:

ok "Bob"

Test #26:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

100
0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1
6 2 3 4 6 99 100
0
0
1 5
0
1 7
1 8
1 9
2 10 13
2 11 12
0
0
3 14 97 98
1 15
1 16
1 17
1 18
2 19 2...

output:

Bob

result:

ok "Bob"

Test #27:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

8
0 0 0 1 1 0 1 1
1 2
1 3
1 4
3 5 6 7
0
0
1 8
0
1
1

output:

Bob

result:

ok "Bob"

Test #28:

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

input:

100
0 0 0 1 1 0 1 0 0 1 0 1 0 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 1 0 0 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 1 0 0 1 1 1 0 1 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 1 1
9 2 3 80 88 89 95 96 97 99
0
1 4
3 5 78 79
3 6 7 8
0
0
5 9 10 11 75 76
0
0
2 12 71
1 13
1 14
3 1...

output:

Bob

result:

ok "Bob"

Test #29:

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

input:

100
0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1
17 2 3 4 9 10 12 13 14 15 16 19 64 66 70 71 99 100
0
0
1 5
2 6 7
0
1 8
0
0
1 11
0
0
0
0
0
1 17
1...

output:

Alice

result:

ok "Alice"

Test #30:

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

input:

1000
1 0 0 1 1 0 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 1 1 0 1 0 0 0 0 1 0 1 1 1 0 0 1 0 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 0 1 1 0 1 1 1 1 0 0...

output:

Alice

result:

ok "Alice"

Test #31:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

777
0 1 0 0 0 1 1 0 0 1 1 0 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 1 1 0 1 0 1 1 1 1 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 ...

output:

Bob

result:

ok "Bob"

Test #32:

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

input:

960
0 1 0 1 0 1 0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 1 1 0 0 0 1 0 0 1 0 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 0 0 1 0 0 1 1 1 0 0 1 1 1 1 1 0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 1 0 0 ...

output:

Bob

result:

ok "Bob"

Test #33:

score: 0
Accepted
time: 581ms
memory: 25264kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

Alice

result:

ok "Alice"

Test #34:

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

input:

10
0 0 0 0 0 0 0 0 0 0
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
0
1
1

output:

Bob

result:

ok "Bob"

Test #35:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

10
1 1 1 1 1 1 1 1 1 1
9 2 3 4 5 6 7 8 9 10
0
0
0
0
0
0
0
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #36:

score: 0
Accepted
time: 327ms
memory: 24484kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

Alice

result:

ok "Alice"

Test #37:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

10
0 1 0 0 1 1 1 1 0 0
3 2 8 9
1 3
2 4 6
1 5
0
1 7
0
0
1 10
0
1
1

output:

Bob

result:

ok "Bob"

Test #38:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

2
0 1
1 2
0
1
1

output:

Bob

result:

ok "Bob"

Test #39:

score: 0
Accepted
time: 22ms
memory: 20440kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

ok "Bob"

Test #40:

score: 0
Accepted
time: 676ms
memory: 34512kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

Alice

result:

ok "Alice"

Test #41:

score: 0
Accepted
time: 122ms
memory: 18968kb

input:

200000
1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1...

output:

Alice

result:

ok "Alice"

Test #42:

score: 0
Accepted
time: 97ms
memory: 18880kb

input:

199285
0 1 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 1 1 1 0 0 1 0 0 1 1 1 0 0 0 1 1 0 1 1 1 1 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0...

output:

Bob

result:

ok "Bob"

Test #43:

score: 0
Accepted
time: 111ms
memory: 18888kb

input:

200000
1 0 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 1 1 0 0 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 0 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0 0 1 1 0 1 1 0 1 0 0 1 1 1 1 1 1 0 1 0 0 0 1 0 0 1 0 1 0 1 0 1 1 1 1 0 0 0 1 1 0 1 1 0 1 1 0...

output:

Alice

result:

ok "Alice"

Test #44:

score: 0
Accepted
time: 90ms
memory: 17680kb

input:

200000
0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1 0...

output:

Alice

result:

ok "Alice"

Test #45:

score: 0
Accepted
time: 84ms
memory: 17716kb

input:

200000
1 0 1 1 1 0 0 0 1 0 1 0 1 1 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 1 0 1 0 1 0 0 0 1 0 0 1 1 1 0 1 0 1 1 1 1 0 1 1 0 0 0 0 1 1 1 1 1 0 1 0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 1 0 0 1 0 0 0 1 1...

output:

Alice

result:

ok "Alice"

Test #46:

score: 0
Accepted
time: 60ms
memory: 17860kb

input:

200000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

ok "Bob"

Test #47:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

3
0 1 0
2 2 3
1 3
0
1
1

output:

Bob

result:

ok "Bob"

Test #48:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

2
1 0
2 2 2
0
1
1

output:

Alice

result:

ok "Alice"

Test #49:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

3
1 1 1
1 2
1 3
0
1
1

output:

Alice

result:

ok "Alice"

Test #50:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

15
1 1 1 1 0 0 1 0 1 1 1 0 0 1 0
2 2 9
2 3 6
2 4 5
0
0
2 7 8
0
0
2 10 13
2 11 12
0
0
2 14 15
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #51:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

27
1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 0 0 1 0 0
2 2 8
2 3 6
2 4 5
0
0
2 12 7
0
2 9 11
2 10 12
0
2 12 27
2 13 20
2 14 17
2 15 16
0
0
2 18 19
0
0
2 21 24
2 22 23
0
0
2 25 26
0
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #52:

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

input:

1
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #53:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

1
1
0
1
1

output:

Alice

result:

ok "Alice"

Test #54:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

3
0 0 0
1 2
1 3
0
1
1

output:

Alice

result:

ok "Alice"

Subtask #3:

score: 0
Wrong Answer

Test #55:

score: 15
Accepted
time: 0ms
memory: 3656kb

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: 0ms
memory: 3536kb

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: 3592kb

input:

3
0 1 0
1 2
1 3
0
1
1

output:

Bob

result:

ok "Bob"

Test #58:

score: 0
Accepted
time: 0ms
memory: 3596kb

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:

Alice

result:

ok "Alice"

Test #59:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

10
1 0 0 1 1 1 0 0 1 0
2 2 3
0
1 4
1 5
1 6
3 7 9 10
1 8
0
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #60:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

10
1 1 1 1 1 1 1 1 1 1
4 2 3 4 10
0
0
1 5
1 6
2 7 8
0
1 9
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #61:

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

input:

10
1 1 1 1 1 1 1 1 1 1
2 2 7
1 3
2 4 6
1 5
0
0
0
1 9
0
0
10
8 10 10 8 10 8 10 10 1 8

output:

Alice

result:

ok "Alice"

Test #62:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

10
1 1 1 1 1 1 1 1 1 1
2 2 3
0
0
1 5
0
2 7 9
1 8
0
0
0
10
6 6 4 1 1 4 10 10 10 6

output:

Alice

result:

ok "Alice"

Test #63:

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

input:

10
1 1 1 1 1 1 1 1 1 1
1 2
0
2 4 5
0
1 6
0
0
0
0
0
10
10 10 1 9 8 9 10 7 7 3

output:

Bob

result:

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

Subtask #4:

score: 0
Wrong Answer

Test #103:

score: 20
Accepted
time: 0ms
memory: 3656kb

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:

Alice

result:

ok "Alice"

Test #104:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

10
1 1 1 1 1 1 1 1 1 1
4 2 3 4 10
0
0
1 5
1 6
2 7 8
0
1 9
0
0
1
1

output:

Alice

result:

ok "Alice"

Test #105:

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

input:

10
1 1 1 1 1 1 1 1 1 1
2 2 7
1 3
2 4 6
1 5
0
0
0
1 9
0
0
10
8 10 10 8 10 8 10 10 1 8

output:

Alice

result:

ok "Alice"

Test #106:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

10
1 1 1 1 1 1 1 1 1 1
2 2 3
0
0
1 5
0
2 7 9
1 8
0
0
0
10
6 6 4 1 1 4 10 10 10 6

output:

Alice

result:

ok "Alice"

Test #107:

score: -20
Wrong Answer
time: 0ms
memory: 3516kb

input:

10
1 1 1 1 1 1 1 1 1 1
1 2
0
2 4 5
0
1 6
0
0
0
0
0
10
10 10 1 9 8 9 10 7 7 3

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:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%