11063 - B2-Sequence
Moderator: Board moderators
-
- Experienced poster
- Posts: 209
- Joined: Sun Jan 16, 2005 6:22 pm
-
- 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

///removed

Last edited by serendipity on Mon Sep 11, 2006 11:19 am, edited 1 time in total.
Hi,
This if-statement effectively ends your input while loop. You do not want this. Take out the break statement and try again.
Code: Select all
while( (scanf("%ld",&N))==1)
{
.
.
.
if(b2[0]<=0) //not a b2-seq
{
flag= 0;
break;
}
.
.
.
}
-
- New poster
- Posts: 6
- Joined: Tue May 09, 2006 9:22 pm
-
- Learning poster
- Posts: 63
- Joined: Tue Sep 20, 2005 12:31 am
- Location: Dhaka
- Contact:
WA
what is the worng :
input:
Output:
thanks in advanced.
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
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.
thanks in advanced.
Amra korbo joy akhdin............................
Hi,
my AC program outputs:
Take a look at case #15, for example. Clearly 3+3=6=1+5.
By the way, input specification states
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.
By the way, input specification states
Cu, ErikThere is a blank line after each test case.

-
- 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.
But why you don't print a blank line after case 16.
Amra korbo joy akhdin............................
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.
-
- Learning poster
- Posts: 60
- Joined: Sun Apr 16, 2006 7:59 pm
change..
then fix PE...
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;
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 ???
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 ???
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????
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.
This may be the address of success.