forked from shashank077/Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBIT2A
More file actions
43 lines (42 loc) · 589 Bytes
/
BIT2A
File metadata and controls
43 lines (42 loc) · 589 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <bits/stdc++.h>
#define ll long long int
//@shahsank3007
using namespace std;
int main()
{
ll T =0;
cin>>T;
while(T--)
{ll n=0;
cin>>n;
ll arr[n];
ll brr[n];
for(ll p=0;p<n;p++)
{
cin>>arr[p];
brr[p]=0;
}
sort(arr,arr+n);
ll idx,c=0;
for (ll i = 0; i < n; i++)
{
c=0;
idx = i;
for (ll j = i+1; j < n; j++)
{
if (arr[j] > arr[idx])
// min_idx = j;
{
c++;
}
}
//cout<<c<<' ';
brr[i]=c;
}
for(ll f=0;f<n;f++)
{
cout<<brr[f]<<' ';
}
}
return 0;
}