#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define pb push_back
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MOD 1000000007
struct sp{
int p;
int id;
int t;
};
int cmp(sp &a, sp &b){
if(a.p!=b.p) return a.p>b.p;
if(a.t!=b.t) return a.t>b.t;
return a.id<b.id;
}
int s[2005][2005];
int main()
{
fastIO;
int n,t,p;
cin>>n>>t>>p;
p--;
vector<int> v(t,n);
for(int i=0; i<n; i++){
for(int j=0; j<t; j++){
cin>>s[i][j];
if(s[i][j]==1) v[j]--;
}
}
vector<sp> r(n,{0,0,0});
for(int i=0; i<n; i++){
r[i].id=i;
for(int j=0; j<t; j++){
if(s[i][j]==1){
r[i].t++;
r[i].p+=v[j];
}
}
}
sort(r.begin(), r.end(), cmp);
for(int i=0; i<n; i++){
if(r[i].id==p){
cout<<r[i].p<<' '<<i+1;
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |