제출 #1257658

#제출 시각아이디문제언어결과실행 시간메모리
1257658islam_2010Poi (IOI09_poi)C++20
0 / 100
550 ms16648 KiB
#include <bits/stdc++.h>

using namespace std;

const int sz = 2005;

vector<int> v[sz];

struct POI {
    int p, ind;
};

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

int main(){

    int n, t, p;
    cin >> n >> t >> p;
    map<int, int> mp;
    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;
        for(int j = 0; j < t; j++){


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

}
#Verdict Execution timeMemoryGrader output
Fetching results...