제출 #991040

#제출 시각아이디문제언어결과실행 시간메모리
991040SoSmolStenPoi (IOI09_poi)C++17
70 / 100
176 ms4224 KiB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e3 + 10;
ll score[N];
bool f[N][N];
int main (int argc, char const *argv[]) {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, t, p; cin >> n >> t >> p;
	for(int i = 1; i <= t; ++i) score[i] = n;	
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= t; ++j){
			cin >> f[i][j];
			score[j] -= f[i][j];
		}
	}
	vector<pair<ll, int>> scoreboard;
	for(int i = 1; i <= n; ++i){
		ll sum = 0;
		for(int j = 1; j <= t; ++j){
			sum += f[i][j] * score[j];
		}
		scoreboard.push_back({sum, i});
	}
	sort(scoreboard.begin(), scoreboard.end(), [](pair<ll, int> a, pair<ll, int> b){
		if(a.first == b.first) return a.second < b.second;
		return a.first > b.first;
	});
	for(int i = 0; i < n; ++i){
		if(scoreboard[i].second == p){
			cout << scoreboard[i].first << ' ' << i + 1;
			return 0;
		}
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...