You are not logged in. Please login at www.codechef.com to post your questions!

×

can anyone give me some more test cases beacuse my all test cases are right still it says wrong answer.

include <iostream>

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; }

asked 01 Aug '18, 02:24

killer4639's gravatar image

1★killer4639
1
accept rate: 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
link

answered 01 Aug '18, 11:32

joffan's gravatar image

5★joffan
9488
accept rate: 13%

Yes Can u plz Specify question

link

answered 01 Aug '18, 22:30

krishyadav007's gravatar image

2★krishyadav007
1047
accept rate: 2%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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