请各位大佬看看我这个暴力策略哪里不对(纯暴力拿0分
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
int x=0,flag=1; char ch=getchar();
while(ch<'0' or ch>'9')
{
if(ch=='-') flag=-1;
ch=getchar();
}
while(ch>='0' and ch<='9')
{
x=x*10+ch-'0';
ch=getchar();
}
return x*flag;
}
struct no1
{
int l,r;
}a[1000000],b[1000000];
inline bool cmp(no1 a,no1 b)
{
return a.l<b.l;
}
int n,m1,m2;
int tot1,tot2;
int t1,t2;
int ans;
inline void work()
{
n=read(); m1=read(); m2=read();
for(register int i=1;i<=m1;i++)
{
a[i].l=read(); a[i].r=read();
}
for(register int i=1;i<=m2;i++)
{
b[i].l=read(); b[i].r=read();
}
sort(a+1,a+1+n,cmp);
sort(b+1,b+1+n,cmp);
for(int i=0;i<=n;i++) //in
{
priority_queue<int,vector<int>,greater<int> > ti1,ti2;
// priority_queue<int> ti1,ti2;
int ansx=0;
int na=i, in=n-i;
if(na!=0)
for(int j=1;j<=m1;j++)
{
if( ti1.empty() or a[j].l>=ti1.top() or ti1.size()+1<=na)
{
ansx++;
while(!ti1.empty() and a[j].l>=ti1.top())
{
ti1.pop();
}
ti1.push(a[j].r);
}
}
if(in!=0)
for(int k=1;k<=m2;k++)
{
if(ti2.empty()or b[k].l>=ti2.top() or ti2.size()+1<=in)
{
ansx++;
while(!ti2.empty() and b[k].l>=ti2.top())
{
ti2.pop();
}
ti2.push(b[k].r);
}
}
ans=max(ans,ansx);
}
printf("%d",ans);
return ;
}
int main()
{
// freopen("airport3.in","r",stdin);
// freopen("out.txt","w",stdout);
work();
return 0;
}