093. Music Non Stop

Codeforces
IDCF10269093
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Music Non Stop You're trying to find the longest possible piece of music, so that you can play music non-stop. Given a list of songs and their durations (in MM:SS, with leading zeros), figure out which song is the longest. The first line of input contains a positive integer $n$: the number of songs. The next $n$ lines contain a string, representing the song title, a space, and the song's duration, in MM:SS format with leading zeroes. (For example, a song that was 7 minutes and 9 seconds long would be written as 07:09). Output a single string: the name of the longest song given in the input. If two songs have the same length, output the one that comes first in the input. ## Input The first line of input contains a positive integer $n$: the number of songs. The next $n$ lines contain a string, representing the song title, a space, and the song's duration, in MM:SS format with leading zeroes. (For example, a song that was 7 minutes and 9 seconds long would be written as 07:09). ## Output Output a single string: the name of the longest song given in the input. If two songs have the same length, output the one that comes first in the input. [samples]
**Definitions** Let $ n \in \mathbb{Z}^+ $ be the number of songs. Let $ S = \{(t_i, d_i) \mid i \in \{1, \dots, n\}\} $ be the set of song entries, where: - $ t_i \in \mathbb{S} $ is the song title (string), - $ d_i \in \mathbb{S} $ is the duration in MM:SS format. Define the function $ f: \mathbb{S} \to \mathbb{Z} $ that converts MM:SS to total seconds: $$ f(\text{MM:SS}) = 60 \cdot \text{MM} + \text{SS} $$ where MM and SS are the integer values of the minute and second parts. **Constraints** 1. $ 1 \leq n \leq 100 $ (implicit from context) 2. Each $ d_i $ is a string of the form "MM:SS" with $ 00 \leq \text{MM} \leq 99 $, $ 00 \leq \text{SS} \leq 59 $ **Objective** Find the song $ (t_j, d_j) \in S $ such that: $$ j = \min\left\{ i \in \{1, \dots, n\} \mid f(d_i) = \max_{1 \leq k \leq n} f(d_k) \right\} $$ Output $ t_j $.
API Response (JSON)
{
  "problem": {
    "name": "093. Music Non Stop",
    "description": {
      "content": "Music Non Stop You're trying to find the longest possible piece of music, so that you can play music non-stop. Given a list of songs and their durations (in MM:SS, with leading zeros), figure out whi",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269093"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Music Non Stop\n\nYou're trying to find the longest possible piece of music, so that you can play music non-stop. Given a list of songs and their durations (in MM:SS, with leading zeros), figure out whi...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of songs.  \nLet $ S = \\{(t_i, d_i) \\mid i \\in \\{1, \\dots, n\\}\\} $ be the set of song entries, where:  \n- $ t_i \\in \\mathbb{S} $ is the song t...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments