#include #include #include #include using namespace std; struct node { int l,r,id,flag; bool operator < (const node &b) const { return r>b.r; } }; priority_queue q; bool cmp(const node &a,const node &b) { if (a.l!=b.l) return a.lb.id; } node a[100010]; int main() { int T; scanf("%d",&T); while (T--) { int n; scanf("%d",&n); for (int i=0;ians) ans=now+numa+numb; if (bad==1) if (now+numa+numb>maxs) maxs=now+numa+numb; } maxs+=!good; if (maxs>ans) ans=maxs; printf("%d\n",ans); } return 0; }