#include <stdio.h>
#include <string.h>
using namespace std;
#define N 1000010
int a[N]; //散列表解决本题
int main(){
memset(a, 0, sizeof(0));
int n;
scanf("%d", &n);
int b, e;
for(int i=0; i<n; ++i){
scanf("%d%d", &b, &e);
for(int j=b; j<e; ++j){
a[j]++;
}
}
for(int i=0; i<n; ++i){
scanf("%d%d", &b, &e);
for(int j=b; j<e; ++j){
a[j]++;
}
}
int total = 0;
for(int i=0; i<N; ++i){
if(a[i] == 2){
total++;
}
}
printf("%d", total);
return 0;
}
ccf201809-2买菜(100分)思路极简
最新推荐文章于 2022-03-21 17:54:51 发布