/*迭代器pair里面可以存放两个数,相当于struct,数据类型可以变化,
如果进行sort排序默认是按照第一个数进行从小到大排序
*/
#include <stdio.h>
#include<stdlib.h>
#include <iostream>
using namespace std;
const int N = 5;
int s[N]={1,2,4,6,8};
int t[N]={3,5,7,9,10};
int solve()
{
pair<int, int> itv[N];
for(int i = 0; i < N; i ++) {
itv[i].first = t[i];
itv[i].second = s[i];
}
sort(itv, itv + N);
int count = 0;
int t = 0;
for(int i = 0; i < N; i ++) {
if(t < itv[i].second) {
count ++;
t = itv[i].first;
}
}
return count;
}
int main() {
cout << solve() << endl;
system("pause");
return 0;
}