507 - Jill Rides Again

All about problems in Volume 5. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

Post by Eduard »

O.I find my mistake and got AC. :D :D
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650
User avatar
GVahe
New poster
Posts: 17
Joined: Thu Aug 05, 2004 6:04 pm
Location: Armenia
Contact:

Post by GVahe »

Did you realize that my test case was

Code: Select all

8
1
-1
1
-100
1
-1
1
?
Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

Post by Eduard »

GVahe wrote:Did you realize that my test case was

Code: Select all

8
1
-1
1
-100
1
-1
1
?
Of course not. If you want others to understand your test, you must write your tests in right form.Anyway my program were giving right answer.
Eduard
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650
User avatar
GVahe
New poster
Posts: 17
Joined: Thu Aug 05, 2004 6:04 pm
Location: Armenia
Contact:

offtop

Post by GVahe »

Eduard wrote:
GVahe wrote:Did you realize that my test case was

Code: Select all

8
1
-1
1
-100
1
-1
1
?
Of course not. If you want others to understand your test, you must write your tests in right form.Anyway my program were giving right answer.
Eduard
:lol: it means that I "help" u writing wrong test for which ur program was giving the right answer. :lol:
Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

Post by Eduard »

it means that I "help" u writing wrong test for which ur program was giving the right answer.
I don't understand you.
Answer for this test
Input

Code: Select all

1 
8 
1 
-1 
1 
-100 
1 
-1 
1 
Is this

Output

Code: Select all

The nicest part of route 1 is between stops 1 and 4
And this answer are giving My Ac and old(WA) programs.
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650
User avatar
GVahe
New poster
Posts: 17
Joined: Thu Aug 05, 2004 6:04 pm
Location: Armenia
Contact:

offtop

Post by GVahe »

[deleted]
User avatar
GVahe
New poster
Posts: 17
Joined: Thu Aug 05, 2004 6:04 pm
Location: Armenia
Contact:

Post by GVahe »

OK, now I understand why you don't understand me :wink:
You should read

... writing wrong <- test -> for which ...
not
... writing ( wrong <- test ) -> for which ...

I think it will be clear for you.
mohiul alam prince
Experienced poster
Posts: 120
Joined: Sat Nov 01, 2003 6:16 am
Location: Dhaka (EWU)

507 getting WA please check my I/O

Post by mohiul alam prince »

Hi
I am getting WA in 507.
this is my

INPUT

Code: Select all

20 

6 
1 
0 
0 
0 
1 


6 
1 
0 
0 
1 
-1 

6 
0 
0 
0 
0 
0 

10 
4 
-5 
4 
-3 
4 
4 
-4 
4 
-5 

10 
4 
-5 
4 
-3 
4 
4 
-4 
4 
5 

6 
-1 
1 
-1 
1 
-1 

6 
1 
-1 
1 
-1 
1 

11 
1 
-1 
1 
-1 
1 
-1 
1 
-1 
1 
-1 

12 
1 
-1 
1 
-1 
1 
-1 
1 
-1 
1 
-1 
1
 
10
1
2
4
5
6
7
8
9

2
0

3
1
-1

6
1
1
-100
1
1

7
1
000
0
0
0
0

6
0
0
0
0
-10000

7
1
1
00
0
0
0

2
0

2
-100

13
1
1
1
1
-1
-1
-1
-1
1
1
1
1

6
1
2
3
4
-10
OUTPUT

Code: Select all

The nicest part of route 1 is between stops 1 and 6
The nicest part of route 2 is between stops 1 and 5
Route 3 has no nice parts
The nicest part of route 4 is between stops 3 and 9
The nicest part of route 5 is between stops 3 and 10
The nicest part of route 6 is between stops 2 and 5
The nicest part of route 7 is between stops 1 and 6
The nicest part of route 8 is between stops 1 and 10
The nicest part of route 9 is between stops 1 and 12
The nicest part of route 10 is between stops 1 and 10
Route 11 has no nice parts
The nicest part of route 12 is between stops 1 and 2
The nicest part of route 13 is between stops 1 and 3
The nicest part of route 14 is between stops 1 and 7
Route 15 has no nice parts
The nicest part of route 16 is between stops 1 and 7
Route 17 has no nice parts
Route 18 has no nice parts
The nicest part of route 19 is between stops 1 and 13
The nicest part of route 20 is between stops 1 and 5
why i am getting WA :(
mohiul alam prince
Experienced poster
Posts: 120
Joined: Sat Nov 01, 2003 6:16 am
Location: Dhaka (EWU)

Post by mohiul alam prince »

Hi
I have found my mistake.and got AC :D
thanks

MAP
midra
Experienced poster
Posts: 119
Joined: Fri Feb 13, 2004 7:20 am
Contact:

507 WA!

Post by midra »

I don't understand Why I get wa!
Maybe my algorithm is wrong, or maybe there is some tricky input
here is my code:

Code: Select all

#include <stdio.h>
int s[20003];
max_subsequence(int r,int t){
  int i,j=0,max[20003],start[20003],res=1,st=-1,en=-1;
  start[0]=1;
  for(i=1;i<r;i++){
    if(max[i-1]>=0){
       max[i]+=max[i-1]+s[i];
       start[i]=start[i-1];
    }
    else{
       max[i]+=s[i];
       start[i]=i;
    }
  }
  for(i=r-1;i>0;i--){
      if(max[i]>res){
         res=max[i];
         st=start[i];
         en=i+1;
      }
      else if (max[i]==res){
         if((i+1-start[i])>=(en-st)){
           st=start[i];
           en=i+1;
         }
      }
  }
  if(st==-1 && en==-1)
     printf("Route %d has no nice parts\n",t+1);
  else
    printf("The nicest part of route %d is between stops %d and %d\n",t+1,st,en);
  for(i=1;i<=r;i++)
    max[i]=0;  
}

int main(){
  int t,r,i,j;
  scanf("%d",&t);
  for(i=0;i<t;i++){
    scanf("%d",&r);
    for(j=1;j<r;j++)
       scanf("%d",&s[j]);
    max_subsequence(r,i);
  }
  system("PAUSE");
  return 0;
}
if someone can help me I would appreciate!
thanks and bye!
mohiul alam prince
Experienced poster
Posts: 120
Joined: Sat Nov 01, 2003 6:16 am
Location: Dhaka (EWU)

Post by mohiul alam prince »

Hi midra
try this Input
Input

Code: Select all

9 

6 
1 
0 
0 
0 
1 


6 
1 
0 
0 
1 
-1 

6 
0 
0 
0 
0 
0 

10 
4 
-5 
4 
-3 
4 
4 
-4 
4 
-5 

10 
4 
-5 
4 
-3 
4 
4 
-4 
4 
5 

6 
-1 
1 
-1 
1 
-1 

6 
1 
-1 
1 
-1 
1 

11 
1 
-1 
1 
-1 
1 
-1 
1 
-1 
1 
-1 

12 
1 
-1 
1 
-1 
1 
-1 
1 
-1 
1 
-1 
1

Output

Code: Select all

The nicest part of route 1 is between stops 1 and 6 
The nicest part of route 2 is between stops 1 and 5 
Route 3 has no nice parts 
The nicest part of route 4 is between stops 3 and 9 
The nicest part of route 5 is between stops 3 and 10 
The nicest part of route 6 is between stops 2 and 5 
The nicest part of route 7 is between stops 1 and 6 
The nicest part of route 8 is between stops 1 and 10 
The nicest part of route 9 is between stops 1 and 12
thanks
MAP
midra
Experienced poster
Posts: 119
Joined: Fri Feb 13, 2004 7:20 am
Contact:

Post by midra »

thanks for your help!
but I get the right outputs for your samples
thanks anyway
byee
mohiul alam prince
Experienced poster
Posts: 120
Joined: Sat Nov 01, 2003 6:16 am
Location: Dhaka (EWU)

Post by mohiul alam prince »

Hi Midra
i have compiled ur code in Microsort Visual c++ 6.0
but i have changed ur code just //system("PAUSE"); this part but it
give's this output

Code: Select all

Route 1 has no nice parts
Route 2 has no nice parts
Route 3 has no nice parts
Route 4 has no nice parts
Route 5 has no nice parts
Route 6 has no nice parts
Route 7 has no nice parts
Route 8 has no nice parts
Route 9 has no nice parts
thanks
MAP
Iwashere
New poster
Posts: 20
Joined: Mon Aug 11, 2003 1:50 pm
Location: Singapore

Post by Iwashere »

I get the correct output when I compiled the program in TC.
mohiul alam prince
Experienced poster
Posts: 120
Joined: Sat Nov 01, 2003 6:16 am
Location: Dhaka (EWU)

Post by mohiul alam prince »

Hi midra
try this one

Code: Select all

1
10
20000
20000
20000
20000
20000
20000
20000
20000
20000
your programm gives

Code: Select all

The nicest part of route 1 is between stops 1 and 2
Thanks
MAP
Post Reply

Return to “Volume 5 (500-599)”