#P9333. [JOISC 2023 Day2] Council
[JOISC 2023 Day2] Council
题目描述
In the council of JOI City, there are assembly members, numbered from to . The council will open a meeting, and the assembly members will take votes on proposed ordinances, numbered from to . If , the assembly member will cast an affirmative vote on the proposed ordinance . If , the assembly member will cast a negative vote on the proposed ordinance .
The council of JOI City will be performed as follows.
- Among the assembly members, they will randomly choose a chairperson by drawing lots.
- The chairperson will choose a deputy chairperson among the assembly members except for the chairperson.
- The votes will be taken on proposed ordinances. Each of the 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 assembly members) cast affirmative votes on it. Here, is the largest integer not exceeding .
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.
输出格式
Write lines to the standard output. The -th line of output should contain the maximum possible number of proposed ordinances approved by the council if the assembly member is chosen as the chairperson.
题目大意
题目翻译
在 JOI 市议会中,有 名议员,编号从 到 。议会将召开会议,议员们将对 项提案进行表决,编号为 到 。如果 ,则议员 将对提案 表决肯定票。如果 ,则议员 将对提案 表决否定票。
JOI 市议会的程序如下所示。
-
在 名议员中,通过抽签随机选择主席。
-
主席将在除了主席以外的其他 名议员中选择副主席。
-
将对 项提案进行表决。除了主席和副主席以外的其他 名议员,每人对每个提案均投票支持或反对。如果大多数议员(即肯定票大于等于 )投票赞成,则议会将批准该提案。其中 表示不超过 的最大整数。
市长 K 希望议会尽可能地批准更多的提案。市长 K 收集了议员的信息并知道每个议员在每个提案上的表决结果。
请编写程序,在给定议员投票信息的情况下,计算每个议员作为主席时议会可以批准的提案数量的最大可能值。
输入格式
从标准输入读取以下数据。
输出格式
输出 行。输出的第 行()应包含议员 作为主席时议会可以批准的提案数量的最大可能值。
样例解释 #1
-
假设议员 被选为主席。如果议员 被选为副主席,则议会将批准三个提案,即提案 。如果议员 被选为副主席,则议会将批准两个提案,即提案 。因此,议会批准的提案数量的最大值是 。在第一行输出 。
-
假设议员 被选为主席。如果议员 被选为副主席,则议会将批准三个提案,即提案 。如果议员 被选为副主席,则议会将批准一个提案,即提案 。因此,议会批准的提案数量的最大值是 。在第二行输出 。
-
假设议员 被选为主席。如果议员 被选为副主席,则议会将批准两个提案,即提案 。如果议员 被选为副主席,则议会将批准一个提案,即提案 。因此,议会批准的提案数量的最大值是 。在第三行输出 。
Translate by
3 3
1 0 0
1 1 0
1 1 1
3
3
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
5
4
6
6
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
2
3
2
2
1
3
2
2
1
2
1
1
0
4 2
1 0
0 1
1 1
1 1
2
2
1
1
提示
【样例解释 #1】
- Let’s consider the case where the assembly member is chosen as the chairperson. If the assembly member is chosen as the deputy chairperson, the council will approve three proposed ordinances, i.e., the proposed ordinances . If the assembly member is chosen as the deputy chairperson, the council will approve two proposed ordinances, i.e., the proposed ordinances . Therefore, the maximum number of proposed ordinances approved by the council is . Output in the first line.
- Let’s consider the case where the assembly member is chosen as the chairperson. If the assembly member is chosen as the deputy chairperson, the council will approve three proposed ordinances, i.e., the proposed ordinances . If the assembly member is chosen as the deputy chairperson, the council will approve one proposed ordinance, i.e., the proposed ordinance . Therefore, the maximum number of proposed ordinances approved by the council is . Output in the second line.
- Let’s consider the case where the assembly member is chosen as the chairperson. If the assembly member is chosen as the deputy chairperson, the council will approve two proposed ordinances, i.e., the proposed ordinances . If the assembly member is chosen as the deputy chairperson, the council will approve one proposed ordinance, i.e., the proposed ordinance . Therefore, the maximum number of proposed ordinances approved by the council is . Output in the third line.
该样例满足子任务 的限制。
【样例解释 #2】
该样例满足子任务 的限制。
【样例解释 #3】
该样例满足子任务 的限制。
【样例解释 #4】
该样例满足所有子任务的限制。
【数据范围】
对于所有测试数据,,,,保证所有输入均为整数。
子任务编号 | 分值 | 限制 |
---|---|---|
无 |