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

24673번 - Aidana and Pita 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB76191727.419%

문제

Aidana loves pita. Yesterday she brought home $n$ pitas. Each pita has a tastiness value, which is an integer. Today three friends of Aidana will come to dinner. She will distribute all $n$ pitas among them; each pita will go to exactly one friend. The happiness of a friend is the sum of tastiness values of all pitas he or she received. Aidana wants to be fair. So help her find a distribution of pitas that minimizes the difference between her friends' maximum and minimum happiness.

입력

The first line contains one integer $n,ドル the number of pitas $(3 \le n \le 25)$.

The second line contains $n$ integers, $a_1, a_2, \ldots, a_n,ドル which are tastiness values for pitas (1ドル \le a_i \le 10^7$).

출력

Print $n$ integers: for each pita, print the friend's index to which this pita should go (friends' indices are 1, 2, and 3).

If there are several possible answers which minimize the difference between maximum and minimum happiness, print any one of them.

제한

예제 입력 1

5
2 3 1 4 2

예제 출력 1

3 2 2 1 3

예제 입력 2

6
3 2 5 3 4 2

예제 출력 2

2 3 1 2 3 1

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2022 > Day 3: Kazakhstan Contest H번

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

출처

대학교 대회

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

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