Submission #1172455

#TimeUsernameProblemLanguageResultExecution timeMemory
1172455lopkusCouncil (JOI23_council)C++20
16 / 100
4094 ms16876 KiB
#include <bits/stdc++.h>+

signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, m;
  std::cin >> n >> m;
  std::vector<std::vector<int>> a(n + 1, std::vector<int>(m + 1));
  for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= m; j++) {
      std::cin >> a[i][j];
    }
  }
  std::vector<int> cnt(m + 1);
  for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= m; j++) {
      cnt[j] += a[i][j];
    }
  }
  for(int x = 1; x <= n; x++) {
    int ans = 0;
    for(int y = 1; y <= n; y++) {
      if(y == x) {
        continue;
      }
      int can = 0;
      for(int i = 1; i <= m; i++) {
        int is = ((cnt[i] - a[x][i] - a[y][i] >= n / 2) ? 1 : 0);
        can += is;
      }
      ans = std::max(ans, can);
    }
    std::cout << ans << "\n";
  }
}

Compilation message (stderr)

council.cpp:1:25: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>+
      |                         ^
#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...