제출 #797046

#제출 시각아이디문제언어결과실행 시간메모리
797046pluto_ishPoi (IOI09_poi)C++14
100 / 100
497 ms23872 KiB
#include <bits/stdc++.h> using namespace std; struct d_score{ int score; int num_problems; int id; }; bool cmp(d_score a, d_score b){ if(a.score == b.score){ if(a.num_problems == b.num_problems) return a.id < b.id; return a.num_problems > b.num_problems; } return a.score > b.score; } int main(){ int n, t, p; cin >> n >> t >> p; vector< vector<int> > a(n, vector<int>(t, 0)); for(vector<int>& x : a){ for(int& y : x) cin >> y; } vector<int> pts(t, 0); for(int i=0;i<t;i++){ for(int j=0;j<n;j++){ if(a[j][i] == 0) pts[i]++; } } vector<d_score> scores(n); for(int i=0;i<n;i++){ int np = 0, sc = 0; for(int j=0;j<t;j++){ if(a[i][j]){ np++; sc += pts[j]; } } scores[i] = d_score{sc, np, i+1}; } sort(scores.begin(), scores.end(), cmp); for(int i=0;i<n;i++){ if(scores[i].id == p){ cout << scores[i].score << " " << i+1 << "\n"; break; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...