Submission #1194149

#TimeUsernameProblemLanguageResultExecution timeMemory
1194149SulAPoi (IOI09_poi)C++20
100 / 100
163 ms16160 KiB
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define popcount(x) __builtin_popcountll(x)
using namespace std;
using namespace chrono;

int score[2000], tasks[2000];

void solve() {
    int n,t,p; cin >> n >> t >> p;
    int a[n][t];
    for (int i = 0; i < n; i++) for (int j = 0; j < t; cin >> a[i][j++]);
    for (int task = 0; task < t; task++) {
        long long get = 0;
        for (int i = 0; i < n; i++)
            get += a[i][task] == 0;
        for (int i = 0; i < n; i++)
            score[i] += get * a[i][task];
    }
    for (int i = 0; i < n; i++) {
        for (int task = 0; task < t; task++) {
            tasks[i] += a[i][task];
        }
    }
    int ind[n];
    iota(ind, ind + n, 0);
    sort(ind, ind + n, [&](int i, int j) {
        return make_tuple(score[i], tasks[i], -i) > make_tuple(score[j], tasks[j], -j);
    });
//    for (int x = 0; x < n; cout << score[x++] << " ");
    cout << score[p-1] << " " << find(ind, ind + n, p-1) - ind + 1;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

//    int t; cin >> t; while (t--)
        solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...