#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// int64_t MAX_INT = 2147483647;
//BASE CASE: n=0? n=1?
//OVERFLOW
// > 10^9
//(combinatorics)
// REPRESENTATION
// int == 10e9
// int64_t == 1000000000
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
int n,t,p;
cin >> n >> t >> p;
int a,b,c;
int contestant_data[n][t];
int count_solved[t];
for (int i = 0; i < t; ++i)
{
count_solved[i] = 0;
}
int k;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < t; ++j)
{
cin >> k;
contestant_data[i][j] = k;
count_solved[j] += k;
}
}
vector<vector<int>> score(n);
for (int i = 0; i < n; ++i)
{
score[i] = {0, i};
for (int j = 0; j < t; ++j)
{
if (contestant_data[i][j]) {
score[i][0] += n - count_solved[j];
}
}
}
sort(score.begin(), score.end());
for (int i = 0; i < n; ++i)
{
if (score[i][1] == p-1) {
cout << score[i][0] << " " << i+1;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |