Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 399 Weeks Ago, 1 Day Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 17 Sep 2017 My Price 6.00

Zoo of Lviv

Little Elephant from the Zoo of Lviv likes cards. He has N cards, each of which has one of 1000 colors. The colors are numbered from 1 to 1000.

Little Elephant and Big Hippo are playing the following game. At first Little Elephant takes some subset of cards, and Big Hippo takes the rest of them. Here, Little Elephant can choose to take all of the cards, or none of the cards.

Then they play 1000 rounds: in round k (k = 1, 2, ..., 1000), they count the number of cards each has of the color k. Let Little Elephant has a cards of the color k, and Big Hippo has b cards of the color k. Then ifa > b Little Elephant scores |a-b| points, otherwise Big Hippo scores |a-b| points in this round, where |x|denotes the absolute value of x.

You are given the number of cards N and the array C - list of colors of all N cards. Find the number of subsets (among all 2N subsets) for which Little Elephant wins the game: that is, he gains more points than Big Hippo in total, if Little Elephant takes the subset at first. Since the answer can be large, print it modulo 1000000007 (109+7).

Input

First line of the input contains single integer T - the number of test cases. Then T test cases follow.

First line of each test case contains single integer N. Second line contains N integers separated by space - the array C.

Output

For each test case, print the answer in one line.

Constraints

1 = T = 100
1 = N = 1000
1 = Ci = 1000, where Ci denotes the i-th element of the array C

Example

Input: 2 3 1 2 3 4 1 1 3 2 Output: 4 5

Answers

(5)
Status NEW Posted 17 Sep 2017 05:09 AM My Price 6.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)