055. Train-ficiency

Codeforces
IDCF10269055
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
A train station needs your help to maximize its efficiency. The train station can only have 100 train carts parked on a track at once, and it is imperative that the tracks are fully filled as to maximize profit. Given a list of trains and their lengths (number of train carts) print the pairs of trains that will most effectively fill the station. You will be given 4 integers separated by spaces. Each of these integers represents the number of cars on a train. Print the pairs of trains. In the first case, Train 1 must be combined with Train 4, as 25 cars plus 75 cars adds up to 100 cars. Train 3 must be combined with Train 4, as 50 cars plus 50 cars equals 100 cars. Also, assume that there is always a way to fill each track with 100 trains. Make sure the output format puts the trains in ascending order (i.e. Train 1 and Train 3, not Train 3 and Train 1). ## Input You will be given 4 integers separated by spaces. Each of these integers represents the number of cars on a train. ## Output Print the pairs of trains. [samples] ## Note In the first case, Train 1 must be combined with Train 4, as 25 cars plus 75 cars adds up to 100 cars. Train 3 must be combined with Train 4, as 50 cars plus 50 cars equals 100 cars.Also, assume that there is always a way to fill each track with 100 trains. Make sure the output format puts the trains in ascending order (i.e. Train 1 and Train 3, not Train 3 and Train 1).
**Definitions** Let $ T = \{t_1, t_2, t_3, t_4\} $ be a tuple of four positive integers representing the lengths (number of carts) of four trains. Let $ S = \{ (i,j) \mid 1 \leq i < j \leq 4 \text{ and } t_i + t_j = 100 \} $ be the set of valid train pairs. **Constraints** 1. $ t_i \in \mathbb{Z}^+ $ for $ i \in \{1,2,3,4\} $ 2. There exists at least one pair $ (i,j) \in S $ such that $ t_i + t_j = 100 $ 3. Exactly two disjoint pairs $ (i,j), (k,l) \in S $ exist, partitioning $ \{1,2,3,4\} $ **Objective** Output the two pairs in $ S $, sorted lexicographically (i.e., each pair $ (i,j) $ with $ i < j $, and the set of pairs ordered by increasing first index).
API Response (JSON)
{
  "problem": {
    "name": "055. Train-ficiency",
    "description": {
      "content": "A train station needs your help to maximize its efficiency. The train station can only have 100 train carts parked on a track at once, and it is imperative that the tracks are fully filled as to maxim",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269055"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "A train station needs your help to maximize its efficiency. The train station can only have 100 train carts parked on a track at once, and it is imperative that the tracks are fully filled as to maxim...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ T = \\{t_1, t_2, t_3, t_4\\} $ be a tuple of four positive integers representing the lengths (number of carts) of four trains.  \nLet $ S = \\{ (i,j) \\mid 1 \\leq i < j \\leq 4 \\text...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments