A - Books
All submissions for this problem are available.
You are given a $sorted$ list $A$ of size $N$.You have to make a new list $B$ such that $B[i]$ is equal to the number of elements $strictly$ $greater$ than $A[i]$ in the list $A$.
Print the $new$ $list$.
The first line consists of $T$, denoting the number of test cases.
First line of each test case consists of one integer denoting $N$, where $N$ is the size of the list given to you.
Second line of each test case contains the list given to you containing $N$ elements.
For each test case print the list in a single line and the elements of the list should be separated by $space$.
Print the answer to $each$ test case in a $new$ $line$.
- $1 \le T \le 100$ , where $T$ is the number of test cases.
- $1 \le N \le 100$, where $N$ is the number of elements in the list.
- $1 \le A[i] \le 1000000$ ,where $A[i]$ is the $ith$ element in the list given to you.
- $15$ $points$: All the elements in the list given to you are distinct.
- $35$ $points$: Original constraints: Elements can be repeated in the list.
1 2 4 4
1 2 2 2 2
3 2 0 0
4 0 0 0 0
The explanation for test case 1 of sample input :
The first element in the new list is 3 since the first element in the previous list was 1, and there are three elements which are strictly greater than 1, that is 2, 4 and 4.
The second element in the new list is 2 since the second element in the previous list was 2, and there are two elements which are strictly greater than 2, that is 4 and 4.
The third and fourth element in the new list is 0 since third and fourth element in the previous list was 4 and there are no elements which are strictly greater than them.
|Time Limit:||0.5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions