Submission #937865

#TimeUsernameProblemLanguageResultExecution timeMemory
937865Muaath_5Poi (IOI09_poi)C++17
5 / 100
184 ms23892 KiB
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>

using namespace std;

const int N = 2000 + 1;

int n, t, p;
int solved[N][N];
int points[N];

struct contestant {
	int id;
	int score = 0;
	int count = 0;
	friend bool operator<(contestant a, contestant b) {
		if (a.score == b.score) {
			if (a.count == b.count) {
				return a.id < b.id;
			}
			return a.count < b.count;
		}
		return a.score < b.score;
	}
} c[N];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> t >> p;
	for (int i = 1; i <= n; i++) {
		c[i].id = i;
		for (int j = 1; j <= t; j++) {
			cin >> solved[i][j];
			c[i].count++;
			if (solved[i][j])
				points[j]++;
		}
	}
	for (int j = 1; j <= t; j++)
		points[j] = n - points[j];
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (solved[i][j])
				c[i].score += points[j];
		}
	}
	sort(c, c + n);
	reverse(c, c + n);
	for (int i = 1; i <= n; i++) {
		if (c[i].id == p) {
			cout << c[i].score << ' ' << i << '\n';
			return 0;
		}
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...