E. Headquarters

Codeforces
IDCF10272E
Time5000ms
Memory256MB
Difficulty
Eric Yuan, founder and CEO of Zoom, has decided that the Zoom company headquarters in San Jose, CA is just not in an ideal location. Rent prices are rising by the day, but more importantly, Eric wants the headquarters building to have some kind of special connection to the Zoom user base, in a way that San Jose is lacking. Eric has decided that the new headquarters building should be placed at the site of the average location of all Zoom users. That way the company can be symbolically placed at the center of its users' lives. Of course, if he truly wanted to follow through with this idea, the building would need to be built somewhere beneath the Earth's crust. But to make his vision feasible in reality, Eric has decided to simplify his model of the world to just consider 2D locations on a flat map. Given a list of $N$ cities, each with a location ($x_i, y_i$) on the map and a population of Zoom users $p_i$ concentrated in that city, help Eric figure out where to build the new Zoom headquarters! The first line of input contains the integer $N$ ($1 <= N < 1000$). The next $N$ lines each consist of three integers: $x_i$, $y_i$ where ($-1000 <= x_i, y_i <= 1000$), and $p_i$ where ($1 <= p_i < 1000$), denoting the coordinate location and user population (in thousands) of the $i^(t h)$ city. Output the average location of all Zoom users, $x_a$ and $y_a$, within a $. 0001$ margin of error. Assume that all Zoom users live exactly at the ($x, y$) location of their home city. ## Input The first line of input contains the integer $N$ ($1 <= N < 1000$). The next $N$ lines each consist of three integers: $x_i$, $y_i$ where ($-1000 <= x_i, y_i <= 1000$), and $p_i$ where ($1 <= p_i < 1000$), denoting the coordinate location and user population (in thousands) of the $i^(t h)$ city. ## Output Output the average location of all Zoom users, $x_a$ and $y_a$, within a $. 0001$ margin of error. Assume that all Zoom users live exactly at the ($x, y$) location of their home city. [samples]
API Response (JSON)
{
  "problem": {
    "name": "E. Headquarters",
    "description": {
      "content": "Eric Yuan, founder and CEO of Zoom, has decided that the Zoom company headquarters in San Jose, CA is just not in an ideal location. Rent prices are rising by the day, but more importantly, Eric wants",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 5000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10272E"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Eric Yuan, founder and CEO of Zoom, has decided that the Zoom company headquarters in San Jose, CA is just not in an ideal location. Rent prices are rising by the day, but more importantly, Eric wants...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments