×

# define lli long long int

using namespace std;

int main() { lli t; cin>>t; while(t--) { lli n,minx,maxx; cin>>n>>minx>>maxx; lli w[n],b[n],a=(-1),p,temp=0; for(lli i=0;i<n;i++) {="" cin="">>w[i]>>b[i]; } for(lli i=n-1;i>=0;i--) { if(temp==0) { if((w[i]%2==0)&&(b[i]%2==0)) { a=(maxx-minx+1);

          break;
}
if((w[i]%2==0)&&(b[i]%2!=0))
{
a=0;

break;
}
if((w[i]%2!=0)&&(b[i]%2!=0))
{
temp=1;
}
if((w[i]%2!=0)&&(b[i]%2==0))
{
temp=0;
}
}
if(temp==1)
{
if((w[i]%2==0)&&(b[i]%2==0))
{
a=0;
break;
}
if(((w[i]%2)==0)&&((b[i]%2)!=0))
{
a=(maxx-minx+1);
break;
}
if(((w[i]%2)!=0)&&((b[i]%2)!=0))
{
temp=1;
}
if(((w[i]%2)!=0)&&((b[i]%2)==0))
{
temp=0;
}
}

}
if(a==(-1))
{
if(temp==0)
{
if(((maxx%2)==0)&&((minx%2)==0))
a=((maxx-minx+2)/2);
else if(((maxx%2)!=0)&&((minx%2)!=0))
a=((maxx-minx)/2);
else
a=((maxx-minx+1)/2);
}
if(temp==1)
{
if(((maxx%2)!=0)&&((minx%2)!=0))
a=((maxx-minx+2)/2);
else if((maxx%2==0)&&(minx%2==0))
a=((maxx-minx)/2);
else
a=((maxx-minx+1)/2);
}
}
p=(maxx-minx+1-a);


cout<<a<<" "<<p<<endl; } return 0; }

1
accept rate: 0%

 0 It's difficult to help unless you say which question you are working on. But I'm guessing it's SPAMCLAS. Try these: 2 2 1 5 3 4 1 3 3 2 10 3 3 1 2 5 1  Output 3 2 5 4  answered 01 Aug '18, 11:32 5★joffan 948●8 accept rate: 13%
 0 Yes Can u plz Specify question answered 01 Aug '18, 22:30 104●7 accept rate: 2%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×163
×82
×70

question asked: 01 Aug '18, 02:24

question was seen: 100 times

last updated: 01 Aug '18, 11:32