fork(1) download
  1. //Cooling Pies COOLING
  2.  
  3. #include <iostream>
  4. #include <cstdio>
  5. #include <algorithm>
  6. using namespace std;
  7. int main()
  8. {
  9. int x, i, z;
  10. scanf ("%d", &x);
  11. for (x; x > 0; --x)
  12. {
  13. int y, a[50], b[50];
  14. scanf ("%d", &y);
  15. for (i = 0; i < y; ++i)
  16. {
  17. scanf ("%d", &a[i]);
  18. }
  19. for (i = 0; i < y; ++i)
  20. {
  21. scanf ("%d", &b[i]);
  22. }
  23. sort (a, a + y);
  24. sort (b, b + y);
  25. z = 0;
  26. for (i = 0; i < y; ++i)
  27. {
  28. if (a[i] <= b[i])
  29. {
  30. z = z + 1;
  31. }
  32. else
  33. {
  34. continue;
  35. }
  36. }
  37. printf ("%d\n", z);
  38. }
  39. return 0;
  40. }
Success #stdin #stdout 0s 3344KB
stdin
2
3
10 30 20
30 10 20
5
9 7 16 4 8
8 3 14 10 10
stdout
3
3