Submission #532898

#TimeUsernameProblemLanguageResultExecution timeMemory
532898alextodoranPoi (IOI09_poi)C++17
100 / 100
275 ms11996 KiB
/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, m, k;
    cin >> n >> m >> k; k--;
    bool solved[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> solved[i][j];
        }
    }
    int points[m];
    for (int j = 0; j < m; j++) {
        points[j] = 0;
        for (int i = 0; i < n; i++) {
            points[j] += !solved[i][j];
        }
    }
    ll score[n];
    int cnt[n];
    for (int i = 0; i < n; i++) {
        score[i] = 0;
        cnt[i] = 0;
        for (int j = 0; j < m; j++) {
            if (solved[i][j]) {
                cnt[i]++;
                score[i] += points[j];
            }
        }
    }
    int better = 0;
    for (int i = 0; i < n; i++) {
        if (i != k) {
            if (score[i] != score[k]) {
                better += (score[i] > score[k]);
            } else if (cnt[i] != cnt[k]) {
                better += (cnt[i] > cnt[k]);
            } else {
                better += (i < k);
            }
        }
    }
    cout << score[k] << " " << 1 + better << "\n";

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...