Submission #1148982

#TimeUsernameProblemLanguageResultExecution timeMemory
1148982blackslexPoi (IOI09_poi)C++20
35 / 100
219 ms16232 KiB
#include<bits/stdc++.h>

using namespace std;
using tp = tuple<int, int, int>;

int n, m, p;

int main() {
    scanf("%d %d %d", &n, &m, &p);
    vector<vector<int>> a(n + 5, vector<int>(m + 5));
    vector<int> cnt(m + 5), cnt2(n + 5);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            scanf("%d", &a[i][j]);
            cnt[j] += 1 - a[i][j];
            cnt2[i] += a[i][j];
        }
    }
    vector<int> b(n);
    vector<tp> c;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            b[i] += cnt[j] * a[i][j];
        }
        c.emplace_back(b[i], cnt2[i], -i);
    }
    sort(c.rbegin(), c.rend());
    int ans = -1;
    for (int i = 0; i < n; i++) {
        if (get<2>(c[i]) == -p) ans = i;
    }
    printf("%d %d", get<0>(c[ans]), ++ans);
}

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d %d", &n, &m, &p);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
poi.cpp:14:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |             scanf("%d", &a[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...