### 511 - Do You Know the Way to San Jose?

Posted:

**Mon Apr 20, 2009 2:04 pm**Anyone knows what's the largest number of maps and or cities? i.e. the limits on the size of each test case?

The Online Judge board

https://uva.onlinejudge.org/board/

Page **1** of **1**

Posted: **Mon Apr 20, 2009 2:04 pm**

Anyone knows what's the largest number of maps and or cities? i.e. the limits on the size of each test case?

Posted: **Fri Jun 15, 2012 11:12 pm**

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?

Posted: **Tue Jun 19, 2012 1:29 am**

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.

Posted: **Mon Jun 25, 2012 3:43 am**

Thanks for the info, Brian! Seems like this problem could use a new dataset...

Posted: **Tue Aug 12, 2014 10:34 am**

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;
......
```

Posted: **Tue Aug 12, 2014 11:50 am**

Your output doesn't match sample. Change line
It must be
Don't forget to remove your code after getting accepted.

Code: Select all

`cout<<name<<" at detail level "<<level<<ends;`

Code: Select all

`cout<<name<<" at detail level "<<level<<" ";`

Posted: **Tue Aug 12, 2014 10:14 pm**

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.

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.

Posted: **Tue Aug 12, 2014 10:19 pm**

printing **ends** will output null character **'\0'** not space.

Posted: **Wed Apr 26, 2017 11:38 am**

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!