#pragma comment(linker, "/STACK:102400000,102400000") #include #include #include #include #include #include #include using namespace std; long long a[100005],T,L,R,n; struct Tnode { long long x,y; } b[100005]; bool cmp(Tnode a,Tnode b) { return a.x> T; for (;T>0;T--) { cin >> n>> L >> R; for (int i=1;i<=n;i++) { cin >> a[i]; } sort(a+1,a+n+1); long long ans=0; for (int i=2;i<=n;i++) { b[i].x=a[i]-a[i-1]+1LL; b[i].y=a[i]+a[i-1]-1LL; } b[1].x=0;b[1].y=L-1LL; n++; b[n].x=R+1LL;b[n].y=1000000000000000005LL; sort(b+1,b+n+1,cmp); ans=0; long long Max=b[1].y; for (int i=1;i<=n;i++) { if (b[i].x>Max) ans+=b[i].x-Max-1LL; Max=max(Max,b[i].y); } cout << ans << endl; } return 0; }