제출 #885062

#제출 시각아이디문제언어결과실행 시간메모리
885062MatjazPoi (IOI09_poi)C++14
100 / 100
492 ms23876 KiB
// // POIIOI2009.cpp // // // Created by Matjaz Leonardis on 09/12/2023. // #include <iostream> #include <vector> #include <algorithm> using namespace std; int N,T,P; int main(){ cin >> N >> T >> P; vector<vector<int> > raw_score(N, vector<int> (T)); vector<int> weight(T); vector<int> tasks_solved(N); for (int i=0;i<N;i++){ for (int j=0;j<T;j++) { cin >> raw_score[i][j]; if (raw_score[i][j] == 0) weight[j]++; else tasks_solved[i]++; } } vector<int> final_score(N); for (int i=0;i<N;i++){ for (int j=0;j<T;j++) if (raw_score[i][j]) final_score[i] += weight[j]; } vector<pair<pair<int,int>, int> > rank; for (int i=0;i<N;i++){ rank.push_back(make_pair(make_pair(final_score[i], tasks_solved[i]), -i)); } sort(rank.rbegin(), rank.rend()); for (int i=0;i<N;i++){ if (rank[i].second == - P + 1){ cout << rank[i].first.first << " " << i + 1 << endl; break; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...