Submission #564808

#TimeUsernameProblemLanguageResultExecution timeMemory
564808PiokemonPoi (IOI09_poi)C++17
0 / 100
231 ms24508 KiB
#include <bits/stdc++.h>
using namespace std;

int worth[2090];
int contestants[2090][2090];
pair<pair<int,int>,int> scores[2090];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,t,p;
    cin >> n >> t >> p;
    for (int x=0;x<=t;x++){
        worth[x] = n;
    }
    for (int x=0;x<n;x++){
        for (int y=0;y<t;y++){
            cin >> contestants[x][y];
            if (contestants[x][y] == 1){
                worth[y] -= 1;
            }
        }
    }
    for (int x=0;x<n;x++){
        scores[x].first.first = 0;
        scores[x].first.second = 0;
        scores[x].second = x+1;
        for (int y=0;y<t;y++){
            if (contestants[x][y] == 1){
                scores[x].first.first += worth[y];
                scores[x].first.second += 1;
            }
        }
    }
    sort(scores,scores+n);
    for (int x=0;x<n;x++){
        if (scores[x].second == p){
            cout << scores[x].first.first << ' ' << x+1 << "\n";
            return 0;
        }
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...