Submission #1300276

#TimeUsernameProblemLanguageResultExecution timeMemory
1300276nathlol2Poi (IOI09_poi)C++20
100 / 100
163 ms17888 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 2222;
int n, t, p, a[N][N], b[N];
vector<pair<int, pair<int, int>>> v;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> t >> p;
    for(int i = 1;i<=n;i++){
        for(int j = 1;j<=t;j++){
            cin >> a[i][j];
            if(a[i][j]) b[j]++;
        }
    }
    for(int i = 1;i<=n;i++){
        int c = 0, g = 0;
        for(int j = 1;j<=t;j++){
            if(a[i][j]) c += (n - b[j]), ++g;
        }
        v.push_back({-c, {-g, i}});
    }
    sort(v.begin(), v.end());
    for(int i = 0;i<n;i++){
        if(v[i].second.second == p){
            cout << -v[i].first << ' ' << i + 1;
            return 0;
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...