제출 #307590

#제출 시각아이디문제언어결과실행 시간메모리
307590sofapudenPoi (IOI09_poi)C++14
60 / 100
1103 ms24668 KiB
#include <bits/stdc++.h>

using namespace std;


bool comp(pair<pair<int,int>,int> a, pair<pair<int,int>,int> b){
	if(a.first.first == b.first.first){
		if(a.first.second == b.first.second){
			return a.second < b.second;
		}
		return a.first.second > b.first.second;
	}
	return a.first.first > b.first.first;
}

int main(){
	int n, t, p; cin >> n >> t >> p;
	vector<int> points(n,0);
	vector<vector<int>> ans(n, vector<int> (t));
	for(auto &x : ans)for(auto &y : x)cin >> y;
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < t; ++j){
			points[j]+=!ans[i][j];
		}
	}
	vector<pair<pair<int,int>,int>> order;
	for(int i = 0; i < n; ++i){
		int cn = 0;
		int po = 0;
		for(int j = 0; j < t; ++j){
			cn+=ans[i][j];
			po+=ans[i][j]*points[j];
		}
		order.push_back({{po,cn},i});
	}
	sort(order.begin(),order.end(), comp);
	for(int i = 0; i < n; ++i){
		if(order[i].second == p-1){
			cout << order[i].first.first << " " << i+1 << "\n";
			return 0;
		}
	}
}
		
#Verdict Execution timeMemoryGrader output
Fetching results...