만드는 중입니다

아직 만드는 중이라 바뀔 수 있습니다

결승 진출팀

시간 제한3초메모리 제한1024 MB

요약
월드 파이널 슬롯 수 N과 여섯 지역의 통계가 주어질 때, 사이트 점수 규칙에 따라 대만 지역에 배정되는 슬롯 수를 구합니다.
난이도

쉬움10점 중 3점

유형
구현, 정렬, 시뮬레이션
정답자
아직 제출이 없습니다

문제

Frank는 아시아 태평양 지역에서 세계 결선 진출권을 얻으려고 최선을 다하고 있다. 하지만 자신의 가능성을 가늠할 선발 규칙을 찾지 못했다. 어젯밤 Frank의 코치가 다음 문서를 찾았다.

=====================================================================
World Finals team selection rules from Asia Pacific (2022 cycle)

Due to COVID-19 outbreak, this year's Asia Pacific rules will
again be quite different from those of usual years. The plan
for having an Asia Pacific semi-final contest (play-off contest)
has been cancelled and postponed to the next year.

Only the following six regionals will be held this year.

Ho Chi Minh, Vietnam
Jakarta, Indonesia
Manila, Philippines
Seoul, Korea
Taoyuan, Taiwan
Yokohama, Japan

We have set a team participation rule. This rule is a special one
for this year (2022 cycle) only.

Teams from a hosting country (Indonesia, Japan, Korea, Philippines,
Taiwan and Vietnam) can only join the regional held in their own
country. Universities from non-hosting countries should choose a
regional. Note that all teams from a single university have to join
the same regional.

World Finals team selection rules are as follows.

Apply Steps A1 through A4 below in this order.

A1. Define the site score of a regional as follows.
0.56 * number of universities in regional
+ 0.24 * number of teams in regional
+ 0.14 * number of universities in preliminary contests
+ 0.06 * number of teams in preliminary contests
+ 0.3 * number of foreign teams

Only teams or universities solving at least one problem are counted.

A2. Sort our six regionals according to their site scores.

A3. Let N be the number of World Finals slots given from the ICPC
Headquarters. Until the sum of the number of allocated slots
reaches N, allocate slots to regionals, one by one, in the
descending order of their site scores. When all six regionals
are allocated one slot each, continue from the regional with the
highest site score in the round robin fashion.

A4. For each regional, let M be the number of slots allocated to the
regional through the step A3. Select the M highest ranked
universities. The team with the highest rank in the university
is automatically selected.
=====================================================================

이 문서가 아시아 태평양 지역 팀에 적용되는 최종 선발 규칙이라고 가정하자. NN과 사이트 점수를 계산하는 데 필요한 수가 주어졌을 때, 타이완에 배정되는 슬롯 수를 구하는 프로그램을 작성하라.

입력

입력은 7줄이다. 첫 줄에는 ICPC 본부가 주는 세계 결선 슬롯 수 NN이 주어진다. 이어지는 여섯 줄에는 문자열 ss와 음이 아닌 정수 다섯 개 p_tp\_t, p_up\_u, r_tr\_t, r_ur\_u, ff가 공백으로 구분되어 주어진다.

ss는 지역 대회를 개최하는 국가다. p_tp\_t는 국가 ss가 개최한 예선에서 문제를 최소 하나 푼 팀 수다. p_up\_u는 국가 ss가 개최한 예선에서 문제를 최소 하나 푼 대학 수다. r_tr\_t는 국가 ss가 개최한 지역 대회에서 문제를 최소 하나 푼 팀 수다. r_ur\_u는 국가 ss가 개최한 지역 대회에서 문제를 최소 하나 푼 대학 수다. ff는 국가 ss가 개최한 지역 대회에서 문제를 최소 하나 푼 외국 팀 수다.

출력

타이완에 배정되는 슬롯 수를 출력한다.

제한

  • NN은 6 이상 50 이하이다.
  • 각 줄의 ss는 서로 다르다.
  • ss는 베트남, 인도네시아, 필리핀, 한국, 타이완, 일본 중 하나다.
  • 0≤p_u≤p_t≤50000 \le p\_u \le p\_t \le 5000
  • 0≤r_u≤r_t≤3000 \le r\_u \le r\_t \le 300
  • 0≤f≤300 \le f \le 30
  • 서로 다른 지역 대회의 사이트 점수는 서로 다르다고 가정해도 된다.
  • 입력 파일의 크기는 64킬로바이트를 넘지 않는다.

힌트

문제에 나온 문서는 공식 문서가 아니다. 공식 규칙은 CJ Hwang 교수의 블로그 https://icpcasia.wp.txstate.edu/를 참고하라.

예제2

  1. 예제 1

    입력
    17
    Japan 500 95 40 30 5
    Vietnam 400 50 150 40 20
    Indonesia 700 25 80 35 20
    Taiwan 200 30 100 35 1
    Korea 600 100 100 70 0
    Philippines 50 10 40 15 15
    
    예상 출력
    3
    
  2. 예제 2

    입력
    16
    Japan 500 95 40 30 5
    Taiwan 200 30 100 35 1
    Indonesia 700 25 80 35 20
    Philippines 50 10 40 15 15
    Korea 600 100 100 70 0
    Vietnam 400 50 150 40 20
    
    예상 출력
    2