제출 #591805

#제출 시각아이디문제언어결과실행 시간메모리
591805ozedPoi (IOI09_poi)C++14
100 / 100
551 ms15948 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pi; bool compare(tuple<int,int,int> &t1,tuple<int,int,int> &t2){ if(get<0> (t1) > get<0>(t2)) return true; else if(get<0> (t1) < get<0>(t2)) return false; else if(get<1> (t1) >get<1> (t2)) return true; else if(get<1> (t1) < get<1> (t2)) return false; else return get<2> (t1) < get<2> (t2); } int main(){ int n,t,p; cin>>n>>t>>p; vector<vi>v(n); vi score(t); vector<tuple<int,int,int>> ranks(n); for(int i=0;i<n;i++){ v[i]=vi(t); for(int j=0;j<t;j++){ cin>>v[i][j]; if(v[i][j]==0){score[j]++;} } } for(int i=0;i<n;i++){ get<2>(ranks[i])=i+1; for(int j=0;j<t;j++){ if(v[i][j]==1){ get<0>(ranks[i])+=score[j]; get<1>(ranks[i])++; } } } sort(ranks.begin(),ranks.end(),&compare); for(int i=0;i<n;i++){ if(get<2>(ranks[i]) == p ){ cout<<get<0>(ranks[i]) << " " << i+1; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...