QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 20

#23751. Questionnaire

Statistics

Problem Statement

A certain school has a plan to go on a school trip, and conducted a questionnaire survey for that purpose. Each student has a student number from $1$ to $n$, and the candidate destinations for the trip are represented by numbers from $1$ to $m$. Each student submits their survey with a $\circ$ mark for the places they want to visit and a $\times$ mark for the places they do not want to visit.

Write a program that outputs the destination numbers in descending order of the number of students who want to visit them. When the number of students is the same, order them by their destination numbers in ascending order.

The name of the input file is input.txt. The $1$-st line of input.txt contains the number of students $n$ and the number of candidate destinations $m$, separated by a space. The $i + 1$-th line contains $m$ numbers separated by spaces, representing the questionnaire results of student $i$, where $\circ$ is represented by $1$ and $\times$ is represented by $0$. Assume that $1 \le n \le 1000, 1 \le m \le 100$.

The name of the output file is output.txt. In output.txt, insert a newline after the output (the destination numbers).

Sample 1

Sample Input 1

4 6
1 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0

Sample Output 1

1 3 2 5 4 6

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.