3578
				
				
				
				8
				
			- Kiếm tiền
 - nguyen minh duc đã kiếm được 35780 đ
 
Link bài:
Thuật toán:
Code:
	
	
	
		
				
			Thuật toán:
-  Với bài này, ta sắp xếp các chương trình theo thứ tự lớn dần về thời gian bắt đầu phát sóng.
 - Dùng 2 vòng for để đếm thủ công.
 
Code:
		Mã:
	
	#include <bits/stdc++.h>
#define ii pair<int, int>
#define fi first
#define se second
#define rep(k, n) for (int i = k; i <= n; i++)
using namespace std;
int n, ans;
ii a[1007];
void read(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen("TIVI.INP", "r", stdin);
    //freopen("TIVI.OUT", "w", stdout);
    cin >> n;
    rep(1, n) cin >> a[i].fi >> a[i].se;
}
void run(){
    sort(a+1, a+n+1);
    rep(1, n-1)
        for (int j = i+1; j <= n; j++)
            if(a[i].se > a[j].fi){
                ans++;
            }else break;
    cout << ans;
}
int main(){
    read();
    run();
    return 0;
}
	
	
			

