Company: Codeville

Difficulty: medium

Problem Statement

Codeville Council Elections There are `n` candidates numbered from `1` to `n` and `m` polling stations numbered from `1` to `m`. Candidate `n` is independent. At station `i`, `a[i][j]` votes were cast for candidate `j`. You may cancel the result of any polling station. Votes from a cancelled station are removed for every candidate. The independent candidate is elected only when their remaining total is **strictly greater** than every other candidate's remaining total. Cancel results at the minimum possible number of stations so that the independent candidate is not elected. Input The first line contains `n` and `m` (`2 <= n <= 100`, `1 <= m <= 100`). The next `m` lines contain `n` integers `a[i][j]` (`0 <= a[i][j] <= 1000`). Output Print `k`, the minimum number of cancelled stations. On the next line print the `k` distinct station indices, in any order. If `k` is zero, print an empty second line. Notes To make the independent candidate not elected, it is sufficie

More Codeville OA questionsInterview experiences