Submission #1257674

#TimeUsernameProblemLanguageResultExecution timeMemory
1257674islam_2010Poi (IOI09_poi)C++20
100 / 100
389 ms32544 KiB

#include <bits/stdc++.h>
#define int long long
using namespace std;

const int sz = 2005;

vector<int> v[sz];

struct POI {
    int p, cnt,  ind;
};

bool cmp(POI &a, POI &b){
    if(a.p != b.p){
        return a.p > b.p;
    }if(a.cnt != b.cnt){
        return a.cnt > b.cnt;
    }
    return a.ind < b.ind;
}

signed main(){

    int n, t, p;
    cin >> n >> t >> p;
    vector<int> mp(t, 0);
    vector<POI> a;

    for(int i = 0; i < n; i++){
        for(int j = 0; j < t; j++){
            int a;
            cin >> a;
            v[i].push_back(a);
            if(a == 0){
                mp[j]++;
            }
        }
    }
    for(int i = 0; i < n; i++){
        int pnt = 0, cnt = 0;
        for(int j = 0; j < t; j++){


            if(v[i][j]){
                pnt += mp[j];
                cnt++;
            }
        }a.push_back({pnt, cnt,  i+1});
    }sort(a.begin(), a.end(), cmp);
    int rank = 0, point = 0;
    for(auto i: a){
        rank++;
        point = i.p;
        if(i.ind == p){
            break;
        }
    }cout << point << " " << rank << endl;

}
#Verdict Execution timeMemoryGrader output
Fetching results...