511 - Do You Know the Way to San Jose?
Moderator: Board moderators
511 - Do You Know the Way to San Jose?
Anyone knows what's the largest number of maps and or cities? i.e. the limits on the size of each test case?
-
- Experienced poster
- Posts: 151
- Joined: Tue Nov 16, 2004 7:23 pm
- Location: Norway
- Contact:
Re: 511 - Do You Know the Way to San Jose?
I'm stuck on this problem, and I can't even get the example right. Could someone tell me where I'm wrong here (or verify that the example is wrong)?
In the second query (San Francisco, level 2), there are three eliglble maps:
Level 1: NCalif, area 572, distance to center sqrt(121.16)
Level 2: SanMateo, area 35, distance to center sqrt(5.41)
Level 3: BayArea, area 35, distance to center sqrt(2.26)
BayArea has a shorter distance to center, so this would make it more preferrable than SanMateo since they both have equal area. However, the correct answer according to the sample output is BayArea.
Have I missed some crucial details, or is this yet another broken problem? This problem wasn't submittable before the migration.
In the second query (San Francisco, level 2), there are three eliglble maps:
Level 1: NCalif, area 572, distance to center sqrt(121.16)
Level 2: SanMateo, area 35, distance to center sqrt(5.41)
Level 3: BayArea, area 35, distance to center sqrt(2.26)
BayArea has a shorter distance to center, so this would make it more preferrable than SanMateo since they both have equal area. However, the correct answer according to the sample output is BayArea.
Have I missed some crucial details, or is this yet another broken problem? This problem wasn't submittable before the migration.
My program using static arrays doesn't crash when assuming 5000 maps, 5000 locations and a maximal name length of 139.Anyone knows what's the largest number of maps and or cities? i.e. the limits on the size of each test case?
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 511 - Do You Know the Way to San Jose?
I agree with your logic that the sample output seems wrong. I got AC on this problem by simply doing a qsort on the area of each map containing that city and ignoring the rest. So my code doesn't consider whether multiple maps have the same area, the distance to center, aspect ratio, distance to the lower right corner, or the smallest x-coordinate. My code matches the sample I/O.
I can confirm that 5000 maps, 5000 locations and a maximal name length of 139 are large enough assumptions.
I can confirm that 5000 maps, 5000 locations and a maximal name length of 139 are large enough assumptions.
Check input and AC output for thousands of problems on uDebug!
-
- Experienced poster
- Posts: 151
- Joined: Tue Nov 16, 2004 7:23 pm
- Location: Norway
- Contact:
Re: 511 - Do You Know the Way to San Jose?
Thanks for the info, Brian! Seems like this problem could use a new dataset...
511 WA- Do You Know the Way to San Jose?
i tried and fixed some problems i found but i still got WA.
my code can pass the sample i/o data.
can anyone offer me some I/O data,plz?
or this is my code,if you are helpful and free,would you help me fix it?
my code can pass the sample i/o data.
can anyone offer me some I/O data,plz?
or this is my code,if you are helpful and free,would you help me fix it?
Code: Select all
......
cout<<name<<" at detail level "<<level<<ends;
......
Last edited by cksteven on Tue Aug 12, 2014 10:18 pm, edited 1 time in total.
Re: 511 WA- Do You Know the Way to San Jose?
Your output doesn't match sample. Change line
It must be
Don't forget to remove your code after getting accepted. ![8)](./images/smilies/icon_cool.gif)
Code: Select all
cout<<name<<" at detail level "<<level<<ends;
Code: Select all
cout<<name<<" at detail level "<<level<<" ";
![8)](./images/smilies/icon_cool.gif)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Re: 511 WA- Do You Know the Way to San Jose?
Thank you very much, @lighted!
Now i knew the difference between
and
.
p.s. My C++ Primer (Chinese Edition) says ends will output a space.
![:D](./images/smilies/icon_biggrin.gif)
Now i knew the difference between
Code: Select all
cout<<ends;
Code: Select all
cout<<" ";
p.s. My C++ Primer (Chinese Edition) says ends will output a space.
Re: 511 WA- Do You Know the Way to San Jose?
printing ends will output null character '\0' not space. ![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
-
- Experienced poster
- Posts: 139
- Joined: Wed May 18, 2011 3:04 pm
Re: 511 - Do You Know the Way to San Jose?
The test data is not strong. For a given location, the area of every map which contains the location is distinct, so for a given level, it exists a only map or not. You even can ignore the preferred rule!
metaphysis: http://uhunt.onlinejudge.org/id/95895
My solutions for UVa problems: https://github.com/metaphysis/Code.
My solutions for UVa problems: https://github.com/metaphysis/Code.