Logo
(追記) (追記ここまで)

34635번 - Art Installation 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB93665176.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.

제한

예제 입력 1

583 290 710
396 65 796
309 800

예제 출력 1

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번

  • 문제를 만든 사람: Nick Wu
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /