Submission #685066

#TimeUsernameProblemLanguageResultExecution timeMemory
685066acceptifyPoi (IOI09_poi)C++17
100 / 100
568 ms15988 KiB
#include <bits/stdc++.h>
using namespace std;

const int mxn = 2005;
const int mxt = 2005;

int n, t, p, ac[mxn][mxt], pt[mxt], scr[mxn], cnt[mxn], rk[mxn];

int main() {
    cin >> n >> t >> p;
    for (int i = 1; i <= n; i++) for (int j = 1; j <= t; j++) {
        cin >> ac[i][j];
        cnt[i] += ac[i][j];
        pt[j] += 1 - ac[i][j];
    }
    for (int i = 1; i <= n; i++) for (int j = 1; j <= t; j++) scr[i] += ac[i][j] * pt[j];
    for (int i = 1; i <= n; i++) rk[i] = i;
    sort(rk + 1, rk + n + 1, [](int x, int y) -> bool {
        if (scr[x] != scr[y]) return scr[x] > scr[y];
        if (cnt[x] != cnt[y]) return cnt[x] > cnt[y];
        return x < y;
    });
    cout << scr[p] << " ";
    for (int i = 1; i <= n; i++) if (rk[i] == p) cout << i << "\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...