Submission #871937

#TimeUsernameProblemLanguageResultExecution timeMemory
871937_uros9Poi (IOI09_poi)C++17
100 / 100
236 ms39668 KiB
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;


signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


    int n,t,p;
    cin >> n >> t >> p;
    vector<vector<int>> matr(n,vector<int>(t));
    for(auto&x:matr){
        for(auto&xx:x)
            cin >> xx;
    }
    vector<int> poeni(t,0);
    for(int j=0; j<t; j++){
        for(int i=0; i<n; i++){
            if(matr[i][j]==0)
                poeni[j]++;
        }
    }
    vector<pair<pair<int,int>,int>> niz(n);
    for(int i=0; i<n; i++){
        int br_poena=0;
        for(int j=0; j<t; j++){
            if(matr[i][j]==1)
                br_poena+=poeni[j];
        }
        niz[i]={{-br_poena,-count(matr[i].begin(),matr[i].end(),1)},i};
    }
    sort(niz.begin(),niz.end());
    for(int i=0; i<n; i++){
        if(niz[i].second==p-1)
            cout << -niz[i].first.first << " " << i+1;
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...