Submission #309877

#TimeUsernameProblemLanguageResultExecution timeMemory
309877TemmiePoi (IOI09_poi)C++17
55 / 100
341 ms11128 KiB
#include <bits/stdc++.h>

int n, t, p;

struct C {
	int id;
	int point = 0;
	std::vector <int> solve;
	bool operator<(const C& other) const {
		if (point == other.point) {
			if (solve.size() == other.solve.size()) return id < other.id;
			return solve.size() > other.solve.size();
		}
		return point > other.point;
	}
};

std::vector <int> task;
std::vector <C> c;

int main() {
	std::ios::sync_with_stdio(0); std::cin.tie(0);
	
	std::cin >> n >> t >> p;
	task.resize(n, 0);
	c.resize(n);
	for (int i = 0; i < n; i++) {
		c[i].id = i;
		for (int j = 0; j < t; j++) {
			bool now; std::cin >> now;
			task[j] += now;
			if (now) c[i].solve.push_back(j);
		}
	}
	for (int i = 0; i < n; i++) {
		task[i] = n - task[i];
	}
	for (int i = 0; i < n; i++) {
		for (int x : c[i].solve) {
			c[i].point += task[x];
		}
	}
	std::sort(c.begin(), c.end());
	for (int i = 0; i < n; i++) {
		if (c[i].id == p - 1) {
			std::cout << c[i].point << " " << i + 1 << "\n";
			return 0;
		}
	}
	
}
#Verdict Execution timeMemoryGrader output
Fetching results...