Submission #631630

#TimeUsernameProblemLanguageResultExecution timeMemory
631630PolishFighterPoi (IOI09_poi)C++17
70 / 100
268 ms6272 KiB
#include<bits/stdc++.h>

using namespace std;

constexpr int MAXN = 2e3 + 10;

int points[MAXN];
bool contestants[MAXN][MAXN];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n, t, p;
	cin >> n >> t >> p;
	p--;
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < t; j++)
		{
			cin >> contestants[i][j];
			if(contestants[i][j] == 0)
			{
				points[j]++;
			}
		}
	}

	int philips_p = 0;

	for(int i= 0; i < t; i++)
	{
		if(contestants[p][i])
		{
			philips_p += points[i];
		}
	}
	
	int philips_r = 1;
	int points2;
	for(int i = 0; i < n ; i++)
	{
		points2 = 0;


		for(int j = 0; j < t; j++)
		{
			if(contestants[i][j])
			{
				points2 += points[j];
			}
		}


		if(points2 > philips_p || (points2 == philips_p && i < p))
		{
			philips_r++;
		}
	}

	cout << philips_p << " " << philips_r << "\n";

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...