-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboast.cpp
More file actions
32 lines (31 loc) · 722 Bytes
/
Copy pathboast.cpp
File metadata and controls
32 lines (31 loc) · 722 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
#include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[n], less = 0, greater = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
int cnt_less = 0, cnt_greater = 0;
for (int j = 0; j < n; j++) {
if (a[j] <= a[i]) {
cnt_less++;
} else {
cnt_greater++;
}
}
if (cnt_less > cnt_greater) {
less++;
} else {
greater++;
}
}
cout << less << endl;
}
return 0;
}