| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 93 | 66 | 51 | 76.119% |
Jolie is setting up an art installation for her cat, Millie. The art installation will be made up of multiple LEDs.
Jolie has decided that she needs a specific number of red LEDs, green LEDs, and blue LEDs. After rummaging through her desk, she has found some of each. She can buy two special types of LEDs, one which can be either red or green, and another which can be either green or blue.
How many of the special LEDs will Jolie need to buy to finish her installation?
The first line of input contains three integers $r,ドル $g$ and $b$ (0ドル \le r,g,b \le 1,円 000$), which are the numbers of red LEDs, green LEDs, and blue LEDs Jolie needs.
The second line contains three integers $c_r,ドル $c_g$ and $c_b$ (0ドル \le c_r,c_g,c_b \le 1,円 000$), which are the numbers of red LEDs, green LEDs, and blue LEDs Jolie already owns.
The third line contains two integers $c_{rg}$ and $c_{gb}$ (0ドル \le c_{rg},c_{gb} \le 2,円 000$), which are the numbers of special LEDs that can be either red or green, and the number of special LEDs that can be either green or blue, that are available for Jolie to buy.
Output a single integer, which is the total number of LEDs Jolie needs to buy to make her installation. Output $-1$ if there aren’t enough LEDs for her to complete her installation.
583 290 710 396 65 796 309 800
412
ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2025 A번
University > MIT > The MIT Programming Contest > 2025-26 > MIT Team Contest 1 A번