F. MaratonIME educates

Codeforces
IDCF10137F
Time2000ms
Memory256MB
Difficulty
English · Original
Formal · Original
USP has many lunch options between all the uni cafeterias and the restaurants inside the campus. An option that is usually chosen by MaratonIME seniors is the restaurant in the School of Education, for its good prices and free jelly. The seniors have years of experience weighting on their shoulders, and therefore have tired legs. So they choose to go to the restaurant by car. Trying to save gas, the seniors always minimize the number of cars necessary to take everyone to the restaurant. The seniors asked you to help them solve their problems. This morning, n cars with seniors arrived in the university, and all of them want to go to the restaurant. Each car holds up to 5 people. What is the minimum number of cars necessary to take everyone to the restaurant to "educate"? On the first line, an integer n, the number of cars. On the second line, n integers a1, ..., an, how many people arrived in each car. *Limits* Print a single integer, the minimum number of cars needed to take everyone to the restaurant. ## Input On the first line, an integer n, the number of cars. On the second line, n integers a1, ..., an, how many people arrived in each car.*Limits* 1 ≤ n ≤ 105. 1 ≤ ai ≤ 5, for all i. ## Output Print a single integer, the minimum number of cars needed to take everyone to the restaurant. [samples]
**Definitions** Let $ n \in \mathbb{Z}^+ $ be the number of cars. Let $ A = (a_1, a_2, \dots, a_n) $ be a sequence of positive integers, where $ a_i $ is the number of people in car $ i $. **Constraints** 1. $ 1 \leq n \leq 10^5 $ 2. $ 1 \leq a_i \leq 5 $ for all $ i \in \{1, \dots, n\} $ **Objective** Compute the minimum number of cars required to transport all people, given that each car can hold at most 5 people: $$ \left\lceil \frac{\sum_{i=1}^{n} a_i}{5} \right\rceil $$
API Response (JSON)
{
  "problem": {
    "name": "F. MaratonIME educates",
    "description": {
      "content": "USP has many lunch options between all the uni cafeterias and the restaurants inside the campus. An option that is usually chosen by MaratonIME seniors is the restaurant in the School of Education, fo",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10137F"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "USP has many lunch options between all the uni cafeterias and the restaurants inside the campus. An option that is usually chosen by MaratonIME seniors is the restaurant in the School of Education, fo...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of cars.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of positive integers, where $ a_i $ is the number of people in car $ i $.  \n\n**Co...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments