×

 0 I have tried all test cases i could think of but i am not able to find why it is giving wrong answer.please help. #include using namespace std; int main() { int t,b,i,k; cin>>t; while(t--) { int len=0; int q[10][2]; int r[501]; for(i=0;i<501;i++) r[i]=0; for(i=0;i<10;i++) for(int j=0;j<2;j++) q[i][j]=0; cin>>b; int s,e,l; for(i=0;i>s>>e>>l; q[l][0]=s; q[l][1]=e; } for(i=0;i<9;i++) { if(q[i][0]==0 && q[i+1][0]==0) continue; if(q[i][1]>=q[i+1][0] && q[i][1]<=q[i+1][1] && q[i][0]=q[i][0] && q[i+1][0]<=q[i][1] && q[i+1][1]>q[i][1]) { for(k=q[i][1];k<=q[i+1][0];k++) if(r[k]==0) { len++; r[k]=1; } } else if(q[i][0]<=q[i+1][0] && q[i][1]>=q[i+1][1]) { for(k=q[i+1][0];k<=q[i+1][1];k++) if(r[k]==0) { len++; r[k]=1; } } else if(q[i][0]>=q[i+1][0] && q[i][1]<=q[i+1][1]) { for(k=q[i][0];k<=q[i][1];k++) if(r[k]==0) { len++; r[k]=1; } } } cout<<500-len<
 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:

×2,719
×2,379
×1,914
×850
×429

question asked: 19 Jan '14, 23:57

question was seen: 747 times

last updated: 21 Jan '14, 14:02