forked from PawanJaiswal08/leetcode-solutions
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathaverageflex.cpp
More file actions
54 lines (49 loc) · 1.08 KB
/
averageflex.cpp
File metadata and controls
54 lines (49 loc) · 1.08 KB
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
44
45
46
47
48
49
50
51
52
53
54
//shree ganeshay namah
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi (3.141592653589)
#define mod 1000000007
#define ll long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int main()
{
int t;
cin>>t;
while(t--)
{
int n, cv = 0, qw = 0, po = 0;
cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int j = 0; j < n; j++)
{
for (int i = 0; i < n; i++)
{
if (a[j] >= a[i]){
cv++;
}
else{
qw++;
}
}
if (cv > qw)
po++;
cv = 0;
qw = 0;
}
cout << po << endl;
}
return 0;
}