#include<bits/stdc++.h>
using namespace std;
const int MXN = 2003;
int n, t, p, sc[MXN], cnt[MXN], nomre[MXN], ord[MXN];
bool slv[MXN][MXN];
int32_t main() {
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
cin >> n >> t >> p; p--;
fill(sc, sc+t, n);
for(int i=0; i<n; i++)
for(int j=0; j<t; j++) {
cin >> slv[i][j];
if(slv[i][j]) {
cnt[i]++;
sc[j]--;
}
}
for(int i=0; i<n; i++)
for(int j=0; j<t; j++)
if(slv[i][j])
nomre[i] += sc[j];
iota(ord, ord+n, 0);
sort(ord, ord+n, [&](int i, int j) {
return nomre[i] > nomre[j]
|| (nomre[i] == nomre[j] && (cnt[i] > cnt[j]
|| (cnt[i]==cnt[j] && i<j)));
});
for(int i=0; i<n; i++)
if(ord[i]==p) cout << nomre[p] << ' ' << i+1 << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |