Page 3 of 6

### Thanks!

Posted: Thu Sep 20, 2007 4:14 pm
hey that does the job. I had unnecessarily put the condition to check for not putting an endline at the very end ...

had one query ... why does this not give PE? When exactly does some submission count as PE?

Thanks a lot! Spent too much time on a relatively simple problem [:(]

Posted: Thu Sep 20, 2007 4:21 pm
The judge has some bugs now ( don't worry, will be fixed ). One of them is PE is given WA.

### Thanks!

Posted: Thu Sep 20, 2007 4:30 pm
Oh ok .. fine.
Also ... one suggestion for the new judge if you can help in that matter ... the old judge used to mail the solutions which I submitted ... was nice to keep track of all the submissions ... is there a similar mechanism which exists for the new judge?
Is this going to be setup soon?

Posted: Thu Sep 20, 2007 4:38 pm
It will be available, too. BTW don't forget to remove your code from the board.

### 2nd Sample Input

Posted: Tue Sep 08, 2009 6:19 pm
Can someone help me by giving explanation how '5 4 1 2 3' is No. Thanks.

Posted: Wed Sep 01, 2010 4:24 am
Your train's coaches are in following order --> 1 2 3 4 5
input-->5 4 1 2 3
coaches #5 so push 1 to 4 in station(stack).
coaches #4 you can get it becoz it is in the top of the station
coaches #1 you can not get it, becoz it is in the bottom of the station
So ans is "No"
Hope this will help!

### need help...

Posted: Sat Mar 12, 2011 9:57 am
hello everyone...
i have build a code to solve this problem 514 - Rails...
while compiling this program i got the test case came true..but i still get WA...here is my code #include <stdio.h>
#include <iostream>
#include <stack>

using namespace std;
stack <int>s;
int i,x,d,perm[1000],n,c;
void awal()
{
while(!s.empty())
{
s.pop();
}
}

void pros()
{
x=0;
for(i=1;i<=n;i++)
{
if(perm[x]==i)
{
x++;
while(!s.empty()&&perm[x]==s.top())
{
s.pop();
x++;
}
} else
{
s.push(i);
}
}
}
void last()
{
if(s.empty())
printf("YES\n");
else
printf("NO\n");
}

int main()
{
while(scanf("%d",&n)&&n)
{
while(scanf("%d",&perm[0]))
{
if(!perm[0])
{
printf("\n");
break;
}
for(i=1;i<n;i++)
scanf("%d",&perm);
awal();
pros();
last();
}
}
return 0;
}

### Re: 514 wa

Posted: Tue Mar 29, 2011 2:51 pm
I am unable to understand the answer 'NO' in any case. can you please briefly tell how you say e.g 3 1 2 give 'No'.
regards

### Re: 514 wa

Posted: Tue Mar 29, 2011 3:03 pm
sorry i understood the problem in wrong.

### Re: 514 wa

Posted: Thu Jan 12, 2012 5:51 pm
the problem provide this output format:
#begin
Yes
No

Yes
#end
but the judge wants us to output this format:
#begin
Yes
No

Yes

#end

i debug this stupid probelm 1 hr....

### Re: 514 wa

Posted: Mon Jan 14, 2013 1:55 pm
I gonna crazy with the problem about printing new line sign '\n' in this problems. I took me 20 minutes to figure out that I have to print TWO '\n' after the last test.

In ACM contest the last '\n' character of the output file is ignored when compare the user's output and the solution's output. Why not UVA system implement this ? This's not the first problem that I have to deal with "Wrong Answer" response just because print less or extra "\n" at the end

### Re: 514 wa

Posted: Mon Jan 14, 2013 9:04 pm
From the problem statement "In addition, there is one empty line after the lines corresponding to one block of the input file." That means there should be a blank line following the last line of the output. If the problem statement says the should be a newline between output blocks, then don't print an extra blank line at the end of the output. A missing or extra newline will result in WA. A missing or extra space may result in PE, but don't count on it.

### 514

Posted: Fri Mar 01, 2013 7:05 am
Can anyone explain this test case...
5 6 4 8 7 3 2 9 1 10
yes

### Re: 514

Posted: Fri Mar 01, 2013 8:05 am
nazmus_20000 wrote:Can anyone explain this test case...
5 6 4 8 7 3 2 9 1 10
yes
I suggest you start by reading the problem statement again. Take your time and read it carefully as many times as necessary until you're confident you understand every detail.

Now, as for the test case you mention, consider this sequence of steps:

Code: Select all

``````              <--- B                      <--- A
step                       station
==========================================================
1                                1 2 3 4 5 6 7 8 9 10
// starting scenario
----------------------------------------------------------
2                                6 7 8 9 10
5
4
3
2
1
// moved 5 from A to station
----------------------------------------------------------
3   5                            6 7 8 9 10
4
3
2
1
// moved 1 from station to B
----------------------------------------------------------
4   5 6                          7 8 9 10
4
3
2
1
// moved 1 from A to B
----------------------------------------------------------
5   5 6 4                        7 8 9 10
3
2
1
// moved 1 from station to B
----------------------------------------------------------
6   5 6 4                        9 10
8
7
3
2
1
// moved 2 from A to station
----------------------------------------------------------
7   5 6 4 8 7 3 2                9 10
1
// moved 4 from station to B
----------------------------------------------------------
8   5 6 4 8 7 3 2 9               10
1
// moved 1 from A to B

.
.
.

the last 2 steps left as an exercise :)
``````

### Re: 514 wa

Posted: Fri Mar 01, 2013 12:31 pm
Thank u so much IVB.....for your help.....i skipped some point.....now its AC>.....