fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. // Speed
  4. #define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  5. // Typedefs
  6. #define int long long
  7. #define pb push_back
  8. #define ff first
  9. #define ss second
  10. #define all(x) (x).begin(), (x).end()
  11. #define rall(x) (x).rbegin(), (x).rend()
  12. #define sz(x) ((int)(x).size())
  13. #define endl '\n'
  14. #define yes cout << "yes\n"
  15. #define no cout << "no\n"
  16. // Loops
  17. #define rep(i,a,b) for(int i=a;i<b;++i)
  18. #define per(i,a,b) for(int i=b-1;i>=a;--i)
  19. #define each(x, a) for (auto& x : a)
  20. // Consts
  21. const int INF = 1e18;
  22. const int MOD = 1e9+7;
  23. const int N = 2e5 + 5;
  24.  
  25. void solve() {
  26. int n;
  27. cin>>n;
  28. int j=0;
  29. vector <int> a(n),b(n);
  30. rep(i,0,n){
  31. cin>>a[i]>>b[i];
  32. }
  33. int count=0;
  34. rep(i,0,n){
  35. rep(j,i+1,n){
  36. if((a[i]>a[j] && b[i]<b[j]) || (a[i]<a[j] && b[i]>b[j]) ) count++;
  37. }
  38. }
  39.  
  40. }
  41.  
  42. int32_t main() {
  43. fast_io;
  44. int t;
  45. cin >> t;
  46. while (t--) {
  47. solve();
  48. }
  49. return 0;
  50. }
Success #stdin #stdout 0.01s 5320KB
stdin
5
2
2 3
1 4
6
2 6
3 9
4 5
1 8
7 10
-2 100
4
-10 10
-5 5
-12 12
-13 13
5
-4 9
-2 5
3 4
6 7
8 10
4
1 2
3 4
5 6
7 8
stdout
Standard output is empty