#include<bits/stdc++.h>
using namespace std;
#define int long long
main()
{
    ios_base::sync_with_stdio(0); 
    cin.tie(0);
    int n,m,p;
    cin>>n>>m>>p;
    p--;
    int s[n]={},w[m]={},a[n][m]={};
    for(int x=0;x<n;x++)
    {
        for(int y=0;y<m;y++)
        {
            cin>>a[x][y];
            w[y]+=(a[x][y]?0:1);
        }
    }
    array<int,3>ar[n];
    for(int x=0;x<n;x++)
    {
        int cnt=0;
        for(int y=0;y<m;y++)
        {
            s[x]+=w[y]*a[x][y];
            cnt+=a[x][y];
        }
        ar[x]={-s[x],-cnt,x};
    }
    sort(ar,ar+n);
    int ps=0;
    for(int x=0;x<n;x++)
    {
        if(ar[x][2]==p)
        {
            ps=x+1;
        }
    }
    cout<<s[p]<<' '<<ps;
}
Compilation message (stderr)
poi.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |