Submission #651122

#TimeUsernameProblemLanguageResultExecution timeMemory
651122ymmPoi (IOI09_poi)C++17
0 / 100
247 ms12092 KiB
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;

const int N = 2048;
int n, t, p; // network time protocol
int task_cnt_solved[N];
int par_cnt_solved[N];
int par_sum_solved[N];
bool solved_par_task[N][N];
int ids[N];

bool cmp(int i, int j)
{
	if (par_sum_solved[i] < par_sum_solved[j])
		return 1;
	if (par_sum_solved[i] > par_sum_solved[j])
		return 0;
	if (par_cnt_solved[i] < par_cnt_solved[j])
		return 1;
	if (par_cnt_solved[i] > par_cnt_solved[j])
		return 0;
	return i < j;
}

int main()
{
	cin.tie(0) -> sync_with_stdio(false);
	cin >> n >> t >> p; --p;
	Loop (par,0,n) Loop (task,0,t) {
		int x;
		cin >> x;
		task_cnt_solved[task] += x;
		par_cnt_solved[par] += x;
		solved_par_task[par][task] = x;
	}
	Loop (par,0,n) Loop (task,0,t) {
		if (solved_par_task[par][task])
			par_sum_solved[par] += n - task_cnt_solved[task];
	}
	iota(ids, ids+n, 0);
	sort(ids, ids+n, cmp);
	int ans = 0;
	for (; ids[ans] != p; ++ans);
	cout << par_sum_solved[p] << ' ' << ans+1 << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...