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

27996번 - Council 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB93332849.123%

문제

In the council of JOI City, there are $N$ assembly members, numbered from 1ドル$ to $N$. The council will open a meeting, and the assembly members will take votes on $M$ proposed ordinances, numbered from 1ドル$ to $M$. If $A_{i, j} = 1,ドル the assembly member $i$ (1ドル ≤ i ≤ N$) will cast an affirmative vote on the proposed ordinance $j$ (1ドル ≤ j ≤ M$). If $A_{i, j} = 0,ドル the assembly member $i$ will cast a negative vote on the proposed ordinance $j$.

The council of JOI City will be performed as follows.

  1. Among the $N$ assembly members, they will randomly choose a chairperson by drawing lots.
  2. The chairperson will choose a deputy chairperson among the $N - 1$ assembly members except for the chairperson.
  3. The votes will be taken on $M$ proposed ordinances. Each of the $N - 2$ assembly members except for the chairperson and the deputy chairperson will cast an affirmative vote or a negative vote on each proposed ordinance. The council will approve a proposed ordinance if a majority of the assembly members (i.e., more than or equal to $\left\lfloor \frac{N}{2} \right\rfloor$ assembly members) cast affirmative votes on it. Here, $\left\lfloor x \right\rfloor$ is the largest integer not exceeding $x$.

Mayor K, the mayor of JOI City, wants the council to approve as many proposed ordinances as possible. Mayor K collected information on assembly members. Mayor K knows, on each proposed ordinance, who will cast an affirmative vote and who will cast a negative vote.

Write a program which, given information of the votes of the assembly members, calculates, for each assembly member, the maximum possible number of proposed ordinances approved by the council if that assembly member is chosen as the chairperson.

입력

Read the following data from the standard input.

$N$ $M$

$A_{1,1}$ $A_{1,2}$ $\cdots$ $A_{1,M}$

$A_{2,1}$ $A_{2,2}$ $\cdots$ $A_{2,M}$

$\vdots$

$A_{N,1}$ $A_{N,2}$ $\cdots$ $A_{N,M}$

출력

Write $N$ lines to the standard output. The $i$-th line (1ドル ≤ i ≤ N$) of output should contain the maximum possible number of proposed ordinances approved by the council if the assembly member $i$ is chosen as the chairperson.

제한

  • 3ドル ≤ N ≤ 300,000円$.
  • 1ドル ≤ M ≤ 20$.
  • 0ドル ≤ A_{i, j} ≤ 1$ (1ドル ≤ i ≤ N,ドル 1ドル ≤ j ≤ M$).
  • Given values are all integers.

서브태스크

번호배점제한
18

$N ≤ 300$.

28

$N ≤ 3000$.

36

$M ≤ 2$.

419

$M ≤ 10$.

515

$M ≤ 14$.

622

$M ≤ 17$.

722

No additional constraints.

예제 입력 1

3 3
1 0 0
1 1 0
1 1 1

예제 출력 1

3
3
2
  • Let’s consider the case where the assembly member 1ドル$ is chosen as the chairperson. If the assembly member 2ドル$ is chosen as the deputy chairperson, the council will approve three proposed ordinances, i.e., the proposed ordinances 1ドル,ドル 2ドル,ドル 3ドル$. If the assembly member 3ドル$ is chosen as the deputy chairperson, the council will approve two proposed ordinances, i.e., the proposed ordinances 1ドル,ドル 2ドル$. Therefore, the maximum number of proposed ordinances approved by the council is 3ドル$. Output 3ドル$ in the first line.
  • Let’s consider the case where the assembly member 2ドル$ is chosen as the chairperson. If the assembly member 1ドル$ is chosen as the deputy chairperson, the council will approve three proposed ordinances, i.e., the proposed ordinances 1ドル,ドル 2ドル,ドル 3ドル$. If the assembly member 3ドル$ is chosen as the deputy chairperson, the council will approve one proposed ordinance, i.e., the proposed ordinance 1ドル$. Therefore, the maximum number of proposed ordinances approved by the council is 3ドル$. Output 3ドル$ in the second line.
  • Let’s consider the case where the assembly member 3ドル$ is chosen as the chairperson. If the assembly member 1ドル$ is chosen as the deputy chairperson, the council will approve two proposed ordinances, i.e., the proposed ordinances 1ドル,ドル 2ドル$. If the assembly member 2ドル$ is chosen as the deputy chairperson, the council will approve one proposed ordinance, i.e., the proposed ordinance 1ドル$. Therefore, the maximum number of proposed ordinances approved by the council is 2ドル$. Output 2ドル$ in the third line.

This sample input satisfies the constraints of Subtasks 1, 2, 4, 5, 6, 7.

예제 입력 2

4 12
1 1 1 0 1 1 0 1 0 1 1 0
1 1 0 1 1 0 1 1 1 1 1 0
0 0 1 1 1 0 0 0 0 0 1 1
1 0 0 0 1 1 1 1 1 0 0 0

예제 출력 2

5
4
6
6

This sample input satisfies the constraints of Subtasks 1, 2, 5, 6, 7.

예제 입력 3

16 4
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1

예제 출력 3

3
3
3
2
3
2
2
1
3
2
2
1
2
1
1
0

This sample input satisfies the constraints of Subtasks 1, 2, 4, 5, 6, 7.

예제 입력 4

4 2
1 0
0 1
1 1
1 1

예제 출력 4

2
2
1
1

This sample input satisfies the constraints of all the subtasks.

힌트

출처

Camp > JOI Spring Training Camp > JOI 2022/2023 Spring Training Camp 2-2번

Camp > JOIG Spring Training Camp > JOIG 2022/2023 Spring Training Camp 1-3번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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