All submissions for this problem are available.
For taking down Superman, Batman has devised a new plan. But for this plan to work, he needs someone's help, a very specific person. And that person is Harley Quinn. He goes to Arkham Asylum to meet her. As we all know, she is a teeny tiny bit crazy. She wants Batman to play a little game, she likes to call it "The Great Swap Game" (She's intelligent, remember?). This is how the game works.
They both get an array A of N numbers. They also get Q queries.
Each query comprises of a set of disjoint sub-arrays and a number K[i] related to each subarray. In each query, the game is played. The player can select a subarray make at most K[i] and at least 1 swap in that subarray on two adjjacent elements A[i] and A[i+1] such that A[i]>A[i+1] in his/her move. You can assume that both Batman and Harley Quinn play optimally. The game ends when a player cannot make a move and then, he/she loses. Given this data, you need to tell who will win given that Batman plays first (He's Batman, right?).
The first line of test file contains the number of test cases T for that file.
- The second line contains two integer N and Q,size of the given array A and number of queries.
- The third line contains N space seperated integer, elements of array A.
- Then Q queries follow.
- First line of each query contains the number of sub-arrays S for that query.
- Then follows S lines containing 3 integers per line L[i], R[i] and K[i], left index of that sub-array, right index of that sub-array and K[i] as explained in the problem statement.
Output Q lines where each line will be "BATMAN", if Batman wins for that query or "HARLEY" if he loses.
- Sum of N over all test cases <= 100000
- Sum of no of subarrays over all queries and test cases <= 10000
Input: 1 5 1 5 4 3 2 1 3 1 2 5 3 3 6 4 5 7 Output: HARLEY
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions