제출 #1334724

#제출 시각아이디문제언어결과실행 시간메모리
1334724zhehanCouncil (JOI23_council)C++20
16 / 100
4093 ms16600 KiB
#include <bits/stdc++.h>
using namespace std;

signed main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> votes(n, vector<int>(m, 0));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> votes[i][j];
    }
  }
  vector<int> sum(m, 0);
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      sum[i] += votes[j][i];
    }
  }
  for (int i = 0; i < n; ++i) {
    int maxpass = 0;
    auto temp = sum;
    for (int j = 0; j < m; ++j) {
      temp[j] -= votes[i][j];
    }
    for (int j = 0; j < n; ++j) {
      auto t = temp;
      if (j != i) {
        for (int k = 0; k < m; ++k) {
          t[k] -= votes[j][k];
        }
        int passed = 0;
        for (int k = 0; k < m; ++k) {
          if (t[k] * 2 > n - 2) {
            passed++;
          }
        }
        maxpass = max(maxpass, passed);
      }
    }
    cout << maxpass << '\n';
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...