#include<iostream>
#include<algorithm>
using namespace std;
const int maxn = 10000;
int s[maxn],t[maxn];
pair<int, int> a[maxn];
int main()
{
int n;
cin >> n;
for(int i=0; i<n; i++)
cin >> s[i];
for(int i=0; i<n; i++)
cin >> t[i];
for(int i=0; i<n; i++)
{
a[i].first = t[i];
a[i].second = s[i];
}
sort(a, a+n);
int ans = 0, t = 0;
for(int i=0; i<n; i++)
{
if(t<a[i].second)
{
ans++;
t = a[i].first;
}
}
cout << ans << endl;
return 0;
}
/*
5
1 2 4 6 8
3 5 7 9 10
3
Process returned 0 (0x0) execution time : 8.684 s
Press any key to continue.
*/
区间调度问题
最新推荐文章于 2022-11-07 15:05:32 发布