#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
int n, t, p;
cin >> n >> t >> p;
vector<int> points(t, n);
// total points, tasks solved, id
vector<vector<int>> ranking;
vector<vector<bool>> board(n, vector<bool>(t));
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++){
int r;
cin >> r;
points[j] -= r;
if(r == 1) board[i][j] = true;
}
}
// get scores
for(int i = 0; i < n; i++){
int score = 0;
int solves = 0;
for(int j = 0; j < t; j++){
if(board[i][j]){
score += points[j];
solves++;
}
}
ranking.push_back({-score, -solves, i + 1});
}
sort(ranking.begin(), ranking.end());
for(int i = 0; i < n; i++){
if(ranking[i][2] == p){
cout << ranking[i][0] * -1 << " " << i + 1 << "\n";
}
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |