10037 - Bridge
Moderator: Board moderators
-
- Learning poster
- Posts: 83
- Joined: Wed Feb 27, 2002 2:00 am
- Location: Taiwan
10037 - Bridge
Here is my thoughts (get WA):
when the number of people > 3, we select one of the two strategies below:
[assume that all the people are sorted so that A is the fastest and Z is the slowest]
1) (AZ), (A), (AY), (A)
2) (AB), (A), (YZ), (B)
and finally we just pass the bridge by using the fastest one.
Is it correct or not? Thanks a lot!
when the number of people > 3, we select one of the two strategies below:
[assume that all the people are sorted so that A is the fastest and Z is the slowest]
1) (AZ), (A), (AY), (A)
2) (AB), (A), (YZ), (B)
and finally we just pass the bridge by using the fastest one.
Is it correct or not? Thanks a lot!
-
- Learning poster
- Posts: 83
- Joined: Wed Feb 27, 2002 2:00 am
- Location: Taiwan
-
- Learning poster
- Posts: 83
- Joined: Wed Feb 27, 2002 2:00 am
- Location: Taiwan
-
- Learning poster
- Posts: 83
- Joined: Wed Feb 27, 2002 2:00 am
- Location: Taiwan
Yes, it works well with the cases of 1, 2, 3 people.
But I still can't find my bugs.
Could somebody test my program if possible? Thanks very much!
But I still can't find my bugs.
Could somebody test my program if possible? Thanks very much!
Code: Select all
Rejudged. :)
Last edited by LittleJohn on Fri Sep 05, 2003 9:14 am, edited 1 time in total.
-
- Learning poster
- Posts: 83
- Joined: Wed Feb 27, 2002 2:00 am
- Location: Taiwan
Thank you, Dr. Cormack.
Scanf in C language will ignore all the empty lines, thus when the data files have an extra line at the end, the C program works well.
I wonder how the judge check program was written..if it used gets() to read the whole line and sscanf to parse the string,
it may be wrong when my output does not match the reading format of that check-program.
Still don't know how to do now..
Scanf in C language will ignore all the empty lines, thus when the data files have an extra line at the end, the C program works well.
I wonder how the judge check program was written..if it used gets() to read the whole line and sscanf to parse the string,
it may be wrong when my output does not match the reading format of that check-program.
Still don't know how to do now..
At Waterloo there were 13 separate input files. One had an extra line. This went unnoticed because, as you said, most programs simply ignored the extra line.
At uva, I assume they concatenated all the input files. So one of the cases would have extra input. I thought you would have to do something like this at the end of each case:
{
char x[1000];
gets(x); /* read to end of line*/
while (gets(x) && *x) {} /* read until empty line */
}
But I just tried this with the Waterloo model solution and it gets WA!
I also tried ignoring "n", the number of people, and I still get WA. I give up.
At uva, I assume they concatenated all the input files. So one of the cases would have extra input. I thought you would have to do something like this at the end of each case:
{
char x[1000];
gets(x); /* read to end of line*/
while (gets(x) && *x) {} /* read until empty line */
}
But I just tried this with the Waterloo model solution and it gets WA!
I also tried ignoring "n", the number of people, and I still get WA. I give up.
-
- Learning poster
- Posts: 83
- Joined: Wed Feb 27, 2002 2:00 am
- Location: Taiwan
This problem is most definately broken. By doing lots of asserts & submissions, I found that the testdata indeed is a concatenation of the 13 testcases on the Waterloo site. The problem is that the 7th test case is faulty, it specifies n=1000, but then contains 1001 integers. This messes things up quite a bit.
I was surprised that so many people still have got this one AC, so I decided to check when people had got it accepted. To my - not so big surprise - nobody has got it AC during the last 3 months (before that, _many_ people each month). Which gives? Something happened 3 months ago (like multiple input!?) which caused the problem to get broke?
I was surprised that so many people still have got this one AC, so I decided to check when people had got it accepted. To my - not so big surprise - nobody has got it AC during the last 3 months (before that, _many_ people each month). Which gives? Something happened 3 months ago (like multiple input!?) which caused the problem to get broke?
-
- New poster
- Posts: 11
- Joined: Mon Sep 02, 2002 4:40 pm
- Location: Poland
I have algorithm like LittleJohn. My program pass all Waterloo tests.
I know that one test has more then n people.
I tried three ways:
1. read n
for i = 1 to n read human
read line until empty line
2. read integer (n, dummy line)
n = 0
read human; n++; until empty line
3. specification
All three method failed. Could you tell me how to solve it?
I know that one test has more then n people.
I tried three ways:
1. read n
for i = 1 to n read human
read line until empty line
2. read integer (n, dummy line)
n = 0
read human; n++; until empty line
3. specification
All three method failed. Could you tell me how to solve it?
-- Krzysztof Sikora
What's going on with 10037?
What are you doing? The test data for 10037 is wrong! May be you have spoiled it while you were formating it?.
My solution gets WA. But I have judge solution! What's wrong?
My solution gets WA. But I have judge solution! What's wrong?