#include "bits/stdc++.h"
using namespace std;
#define int long long
signed main()
{
cin.tie(0) -> sync_with_stdio(0);
int n, t, p;
cin >> n >> t >> p;
char s[n][t];
int w[t] = {};
array<int, 3>scrs[n];
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++) cin >> s[i][j];
int cnt = 0;
for(int c = 0; c < t; c++){
if(s[i][c] == '1'){
cnt++;
w[c]++;
}
}
scrs[i] = {0, cnt, 0};
if(i == p - 1) scrs[i][2] = 1;
}
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++) scrs[i][0] += (s[i][j] == '1' ? n - w[j] : 0);
}
sort(scrs, scrs + n);
reverse(scrs, scrs + n);
cout << '\n';
for(int i = 0; i < n; i++){
if(scrs[i][2] == 1) return cout << scrs[i][0] << ' ' << i + 1, 0;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |