제출 #1193421

#제출 시각아이디문제언어결과실행 시간메모리
1193421jecklexPoi (IOI09_poi)C++20
100 / 100
153 ms16096 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;

// int64_t MAX_INT = 2147483647;

//BASE CASE: n=0? n=1?
//OVERFLOW
	// > 10^9
	//(combinatorics)
// REPRESENTATION
	// int == 10e9
	// int64_t == 1000000000

struct sort_f
{
    inline bool operator() (const vector<int>& v1, const vector<int>& v2)
    {
    	if (v1[0] > v2[0]) {
    		return true;
    	}
    	if (v1[0] == v2[0] and v1[1] > v2[1]) {
    		return true;
    	}
    	if (v1[0] == v2[0] and v1[1] == v2[1] and v1[2] < v2[2]) {
    		return true;
    	}
    	return false;
    }
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	// freopen(".in", "r", stdin);
	// freopen(".out", "w", stdout);

	int n,t,p;
	cin >> n >> t >> p;

	int a,b,c;

	int contestant_data[n][t];
	int count_solved[t];

	for (int i = 0; i < t; ++i)
	{
		count_solved[i] = 0;
	}

	int k;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < t; ++j)
		{
			cin >> k;
			contestant_data[i][j] = k;
			count_solved[j] += k;
		}
	}

	vector<vector<int>> score(n);

	for (int i = 0; i < n; ++i)
	{
		// score tasks id
		score[i] = {0, 0, i};
		for (int j = 0; j < t; ++j)
		{
			if (contestant_data[i][j]) {
				score[i][0] += n - count_solved[j];
				score[i][1]++;
			}
		}
	}


	sort(score.begin(), score.end(), sort_f());


	for (int i = 0; i < n; ++i)
	{
		if (score[i][2] == p-1) {
			cout << score[i][0] << " " << i+1;
		}
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...