Submission #631645

#TimeUsernameProblemLanguageResultExecution timeMemory
631645PolishFighterPoi (IOI09_poi)C++17
70 / 100
219 ms16052 KiB
#include<bits/stdc++.h>

using namespace std;

constexpr int MAXN = 2e3 + 10;

int points[MAXN];
int 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;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= t; j++)
		{
			cin >> contestants[i][j];
			if(contestants[i][j] == 0)
			{
				points[j]++;
			}
		}
	}

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


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


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

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

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