#include <iostream>
#include <vector>
using namespace std;
struct person {
int points = 0;
int solved = 0;
int id = 0;
bool operator<(person const& other) const {
if(points == other.points && solved == other.solved) return id < other.id;
if(points == other.points) return solved > other.solved;
return points > other.points;
}
};
int main() {
int n, t, p; cin >> n >> t >> p;
vector<vector<int>> solved(n+1);
vector<int> tasks(t+1,0);
vector<person> people;
int a;
for(int i = 1; i <= n; i++) {
for(int j = 0; j < t; j++) {
cin >> a;
if(a) {
solved[i].push_back(j);
tasks[j]++;
}
}
}
for(int i = 1; i <= n; i++) {
int points = 0;
for(int j = 0; j < solved[i].size(); j++) {
points += n - tasks[solved[i][j]];
}
people.push_back({points,(int) solved[i].size(),i});
}
sort(people.begin(),people.end());
for (int i = 0; i < n; i++) {
if (people[i].id == p) {
cout << people[i].points << " " << i+1 << "\n";
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |