fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7.  
  8. int t;
  9. cin >> t;
  10. while (t--) {
  11. int n, h, l;
  12. cin >> n >> h >> l;
  13.  
  14. int rows = 0, cols = 0;
  15. for (int i = 0; i < n; i++) {
  16. int x;
  17. cin >> x;
  18. if (1 <= x && x <= h) rows++;
  19. if (1 <= x && x <= l) cols++;
  20. }
  21.  
  22. cout << min({rows, cols, n / 2}) << "\n";
  23. }
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0.01s 5316KB
stdin
7
2 1 1
1 1
5 2 2
1 2 2 3 2
8 4 2
7 2 2 2 3 4 4 2
7 3 6
10 4 1 3 5 4 6
2 4 4
5 5
7 6 3
10 4 1 3 5 4 6
4 1 1
1 1 1 1
stdout
1
2
4
2
0
2
2