제출 #940869

#제출 시각아이디문제언어결과실행 시간메모리
940869HappyCapybaraPoi (IOI09_poi)C++17
100 / 100
470 ms24176 KiB
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n, t, p;
    cin >> n >> t >> p;
    vector<int> st(t, n);
    vector<vector<int>> ts(n);
    for (int i=0; i<n; i++){
        for (int j=0; j<t; j++){
            int x;
            cin >> x;
            ts[i].push_back(x);
            if (x) st[j]--;
        }
    }
    vector<pair<int, pair<int,int>>> scores;
    for (int i=0; i<n; i++){
        int score = 0, tasks = 0;
        for (int j=0; j<t; j++){
            if (ts[i][j]){
                tasks++;
                score += st[j];
            }
        }
        scores.push_back({score, {tasks, -i}});
    }
    sort(scores.begin(), scores.end());
    //for (pair<int,pair<int,int>> v : scores) cout << v.first << " " << v.second.first << " " << -v.second.second << "\n";
    for (int i=0; i<n; i++){
        if (-scores[i].second.second == p-1){
            cout << scores[i].first << " " << n-i << "\n";
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...