제출 #663284

#제출 시각아이디문제언어결과실행 시간메모리
663284esomerPoi (IOI09_poi)C++17
5 / 100
277 ms23892 KiB
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define endl "\n"

const int MOD = 1e9 + 7;

void solve(){
    int n, t, p; cin >> n >> t >> p; p--;
    vector<int> scores(t, n);
    vector<vector<int>> v(n, vector<int>(t));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < t; j++){
            int x; cin >> x;
            if(x == 1) scores[j]--;
            v[i][j] = x;
        }
    }
    vector<pair<int, int>> res;
    for(int i = 0; i < n; i++){
        int score = 0;
        for(int j = 0; j < t; j++){
            if(v[i][j]) score += scores[j];
        }
        res.push_back({score, i});
    }
    sort(res.begin(), res.end());
    for(int i = 0; i < n; i++){
        if(res[i].second == p){
            cout << res[i].first << " "<< i + 1 << endl;
            return;
        }
    }
}

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

    //freopen("inpt.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);

    //int tt; cin >> tt;
    int tt = 1;
    for(int t = 1; t <= tt; t++){
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...