Submission #818050

#TimeUsernameProblemLanguageResultExecution timeMemory
818050SUNWOOOOOOOOCouncil (JOI23_council)C++17
16 / 100
339 ms980 KiB
// joisc 2023 : council
#include <bits/stdc++.h>
using namespace std;
const int mxN = 3000, mxM = 20;
int n, m, A[mxN][mxM], s[mxM];

int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            scanf("%d", &A[i][j]);
            s[j] += A[i][j];
        }
    }

    for (int i = 0; i < n; i++){
        int ans = 0;
        for (int j = 0; j < m; j++) s[j] -= A[i][j];
        for (int k = 0; k < n; k++){
            if (i == k) continue;
            int ret = 0;
            for (int j = 0; j < m; j++) s[j] -= A[k][j];
            for (int j = 0; j < m; j++) if (s[j] >= n / 2) ret++;
            for (int j = 0; j < m; j++) s[j] += A[k][j];
            ans = max(ans, ret);
        }
        for (int j = 0; j < m; j++) s[j] += A[i][j];
        printf("%d\n", ans);
    }

    return 0;
}

Compilation message (stderr)

council.cpp: In function 'int main()':
council.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
council.cpp:12:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |             scanf("%d", &A[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~~
#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...