## 11063 - B2-Sequence

Moderator: Board moderators

Ecou
New poster
Posts: 10
Joined: Wed Aug 09, 2006 11:47 pm
Case 2:
4
15 16 17 18

is not a b2-seq. 15 + 17 = 16 + 16 for example. You probably forgot
to start at i = j because of "... for all i<=j" instead of i<j.

asif_rahman0
Experienced poster
Posts: 209
Joined: Sun Jan 16, 2005 6:22 pm
thnx a lot.
Yes i totally missed "i<=j".

bye

miras
Learning poster
Posts: 98
Joined: Sat Jun 14, 2003 1:45 pm
Great thanks to Observer for his help

I finally got AC ...
Remember Never Give Up
Miras

serendipity
New poster
Posts: 6
Joined: Tue May 09, 2006 9:22 pm

### 11063 - B2-Sequence

can anyone tell me wot is the problem wid my code for b2-sequence? Im still getting WA:(

///removed

Last edited by serendipity on Mon Sep 11, 2006 11:19 am, edited 1 time in total.

daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Hi,

Code: Select all

``````while( (scanf("%ld",&N))==1)
{
.
.
.
if(b2[0]<=0) //not a b2-seq
{
flag= 0;
break;
}

.
.
.
}
``````
This if-statement effectively ends your input while loop. You do not want this. Take out the break statement and try again.

serendipity
New poster
Posts: 6
Joined: Tue May 09, 2006 9:22 pm
hey Daveon Thanx a lot. I get AC @last:D

daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am

mohsincsedu
Learning poster
Posts: 63
Joined: Tue Sep 20, 2005 12:31 am
Location: Dhaka
Contact:

### WA

what is the worng :

input:

Code: Select all

``````4
1 2 3 3
4
15 16 17 18
4
-5 0 5 9
6
1 9 19 0 45 70
6
1 9 19 45 70 150
5
15 16 -1 17 18
4
2 2 2 3
4
2 2 2 2
4
1 9 18 36
5
1 9 10 18 36
5
20 30 40 50 60
3
1 3 5
6
2 6 3 2 6 3
2
2 2
3
1 3 5
3
0 1 3``````
Output:

Code: Select all

``````Case #1: It is not a B2-Sequence.

Case #2: It is not a B2-Sequence.

Case #3: It is not a B2-Sequence.

Case #4: It is not a B2-Sequence.

Case #5: It is a B2-Sequence.

Case #6: It is not a B2-Sequence.

Case #7: It is not a B2-Sequence.

Case #8: It is not a B2-Sequence.

Case #9: It is a B2-Sequence.

Case #10: It is not a B2-Sequence.

Case #11: It is not a B2-Sequence.

Case #12: It is a B2-Sequence.

Case #13: It is not a B2-Sequence.

Case #14: It is a B2-Sequence.

Case #15: It is a B2-Sequence.

Case #16: It is not a B2-Sequence.

``````

Amra korbo joy akhdin............................

Erik
Learning poster
Posts: 67
Joined: Fri Jul 01, 2005 11:29 am
Location: Germany
Contact:
Hi,

my AC program outputs:

Code: Select all

``````Case #1: It is not a B2-Sequence.

Case #2: It is not a B2-Sequence.

Case #3: It is not a B2-Sequence.

Case #4: It is not a B2-Sequence.

Case #5: It is a B2-Sequence.

Case #6: It is not a B2-Sequence.

Case #7: It is not a B2-Sequence.

Case #8: It is not a B2-Sequence.

Case #9: It is a B2-Sequence.

Case #10: It is not a B2-Sequence.

Case #11: It is not a B2-Sequence.

Case #12: It is not a B2-Sequence.

Case #13: It is not a B2-Sequence.

Case #14: It is not a B2-Sequence.

Case #15: It is not a B2-Sequence.

Case #16: It is not a B2-Sequence.``````
Take a look at case #15, for example. Clearly 3+3=6=1+5.

By the way, input specification states
There is a blank line after each test case.
Cu, Erik

mohsincsedu
Learning poster
Posts: 63
Joined: Tue Sep 20, 2005 12:31 am
Location: Dhaka
Contact:

### Acc

Thanks to Erik

But why you don't print a blank line after case 16.
Amra korbo joy akhdin............................

Erik
Learning poster
Posts: 67
Joined: Fri Jul 01, 2005 11:29 am
Location: Germany
Contact:
Hi,

I'm sorry - of course it's in the output, but it didn't survive to be copied here into the forum

Cu, Erik

chetan
New poster
Posts: 43
Joined: Sun Sep 24, 2006 2:39 pm
hi all i am getting WA . can anybody plz help me with test cases

Code: Select all

``````
CODE DELETED AFTER AC

``````
Last edited by chetan on Mon Jul 16, 2007 5:25 am, edited 1 time in total.

ayeshapakhi
Learning poster
Posts: 60
Joined: Sun Apr 16, 2006 7:59 pm
change..

Code: Select all

``````if(arr[0] <= 0)   flag = 1;

for(int i=0;i<n;i++)
if(arr[i] <= 0 || arr[i]>10000)    flag = 1;

for(int i=1;i<n;i++)
if(arr[i] <= arr[i-1])   flag = 1;
``````
then fix PE...

chetan
New poster
Posts: 43
Joined: Sun Sep 24, 2006 2:39 pm
thanks. but i got AC in 0.07s
many ppl have got ac in 0.002 ~ 0.004s. what optimizations can i make to speed it up ????
i made all possible optimizations. i even break out of the loops immediately when i find an error condintion and proceed to process the next test case.

is there any other better algo ???

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am

### Re: 11063 - B2-Sequence

Is there any mistake in the algo??? Is there any test case failed??? I don't know why so many WA..
Why this gives WA????

Code: Select all

``deleted``
Last edited by Obaida on Wed Jul 30, 2008 2:07 pm, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.