fork download
  1. #include <bits/stdc++.h>
  2. #include <ext/pb_ds/assoc_container.hpp>
  3. #include <ext/pb_ds/tree_policy.hpp>
  4. #define FASTIO() \
  5.   ios_base::sync_with_stdio(false); \
  6.   cin.tie(NULL);
  7. using namespace std;
  8.  
  9. //<------------------------------------------------------------------------------------------------------------------------------------------------------------------------------>
  10. // DEBUG AND TEMPLATE
  11. void __print(int x) {cerr << x;}
  12. void __print(long x) {cerr << x;}
  13. void __print(long long x) {cerr << x;}
  14. void __print(unsigned x) {cerr << x;}
  15. void __print(unsigned long x) {cerr << x;}
  16. void __print(unsigned long long x) {cerr << x;}
  17. void __print(float x) {cerr << x;}
  18. void __print(double x) {cerr << x;}
  19. void __print(long double x) {cerr << x;}
  20. void __print(char x) {cerr << '\'' << x << '\'';}
  21. void __print(const char *x) {cerr << '\"' << x << '\"';}
  22. void __print(const string &x) {cerr << '\"' << x << '\"';}
  23. void __print(bool x) {cerr << (x ? "true" : "false");}
  24.  
  25. template<typename T, typename V>
  26. void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
  27. template<typename T>
  28. void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
  29. void _print() {cerr << "]\n";}
  30. template <typename T, typename... V>
  31. void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
  32.  
  33.  
  34.  
  35.  
  36. #ifndef ONLINE_JUDGE
  37. #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
  38. #else
  39. #define debug(x...)
  40. #endif
  41.  
  42. // ordered set
  43. // find_by_order, order_of_key
  44. // order_of_key (k) : Number of items strictly smaller than k.
  45. // find_by_order(k) : K-th element in a set (counting from zero)
  46. using namespace __gnu_pbds;
  47. template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ;
  48. template<class T> using ordered_multiset = tree<T, null_type,less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>;
  49. template<class key, class value, class cmp = std::less<key>> using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
  50. struct pair_hash {
  51. template <class T1, class T2>
  52. size_t operator()(const std::pair<T1, T2>& p) const {
  53. auto h1 = std::hash<T1>{}(p.first);
  54. auto h2 = std::hash<T2>{}(p.second);
  55. return h1 ^ (h2 << 1);
  56. }
  57. };
  58. //<----------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
  59. class DSU {
  60. public:
  61. vector<int> Size, parent;
  62. void make(int n) {
  63. Size.resize(n , 1);
  64. parent.resize(n);
  65. for (int i = 0; i < n; i++) {
  66. parent[i] = i;
  67. }
  68. }
  69. int get(int node) {
  70. if (node == parent[node])
  71. return node;
  72. return parent[node] = get(parent[node]);
  73. }
  74. void unite(int u, int v) {
  75. int ulp_u = get(u);
  76. int ulp_v = get(v);
  77. if (ulp_u == ulp_v) return;
  78. if (Size[ulp_u] < Size[ulp_v]) {
  79. parent[ulp_u] = ulp_v;
  80. Size[ulp_v] += Size[ulp_u];
  81. } else {
  82. parent[ulp_v] = ulp_u;
  83. Size[ulp_u] += Size[ulp_v];
  84. }
  85. }
  86. };
  87.  
  88. // cantor function always give a unique output for any 2 numbers.
  89. int cantor(int a, int b){
  90. return ((a + b) * (a + b + 1)) / 2 + b;
  91. }
  92. void precision(int n) {
  93. cout << fixed << setprecision(n);
  94. }
  95. /*
  96.  
  97. static const int N = 1e6;
  98. set<long long>prime;
  99. void sieve(){
  100.   bool p[N];
  101.   memset(p, 1, sizeof p);
  102.   for(int i = 2; i * i < N; ++i){
  103.   if(p[i]){
  104.   for(int j = i * i; j < N; j += i){
  105.   p[j] = 0;
  106.   }
  107.   }
  108.   }
  109.   for(int i = 2; i < N; ++i){
  110.   if(p[i]) prime.insert(i);
  111.   }
  112. }
  113. */
  114. static const int MOD = 1000000007;
  115. int add(int x, int y){
  116. return (((x) % MOD + (y) % MOD) % MOD + MOD) % MOD;
  117. }
  118. int mul(int x, int y){
  119. return ((x % MOD) * 1ll * (y % MOD)) % MOD;
  120. }
  121. double logab (int a, int b){
  122. return log(b) / log(a);
  123. }
  124. long long fast_pow(long long a, long long b) {
  125. long long result = 1;
  126. while (b > 0) {
  127. if (b & 1)
  128. result *= a;
  129. a *= a;
  130. b >>= 1;
  131. }
  132. return result;
  133. }
  134. //<------------------------------------------------------------------------------------------------------------------------------------------------------------------------------>
  135.  
  136.  
  137.  
  138. void solve(){
  139. int n, a, y;
  140. cin >> n >> a >> y;
  141. int parity = 0;
  142. for(int i = 0; i < n; ++i){
  143. int ele; cin >> ele;
  144. parity += (ele & 1);
  145. }
  146. parity += (a & 1);
  147. parity &= 1;
  148. cout << parity << " " << (y % 2) << "\n";
  149. if(parity == (y & 1)){
  150. cout << "ALICE" << "\n";
  151. }
  152. else{
  153. cout << "BOB" << "\n";
  154. }
  155. }
  156. int main() {
  157. FASTIO();
  158. int t = 1;
  159. cin >> t;
  160. while (t--) {
  161. solve();
  162. }
  163. return 0;
  164. }
Success #stdin #stdout 0s 5320KB
stdin
4
1 7 9
2
2 0 2
1 3
4 0 1
1 2 3 4
2 1000000000 3000000000
1000000000 1000000000
stdout
1 1
ALICE
0 0
ALICE
0 1
BOB
0 1
BOB