| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 863778 | Trisanu_Das | Olympiads (BOI19_olympiads) | C++17 | 2073 ms | 133524 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
 
constexpr int maxn = 510, maxk = 10;
 
int n, k, c;
int a[maxn][maxk];
 
vector<int> tot;
 
int get(vector<int> vt) {
	static int aq[maxk];
	memset(aq, 0, sizeof aq);
	for(int x : vt) {
		for(int j = 0; j < k; j++)
			aq[j] = max(aq[j], a[x][j]);
	}
	int ans = 0;
	for(int j = 0; j < k; j++)
		ans += aq[j];
	return ans;
}
 
void create(int id, vector<int> a) {
	if(id == k) return (void)(tot.push_back(get(a)));
	for(int j = a.back()+1; j < n; j++) {
		a.push_back(j);
		create(id+1, a);
		a.pop_back();
	}
}
 
int main() {
	scanf("%d %d %d", &n, &k, &c);
	for(int i = 0; i < n; i++)
		for(int j = 0; j < k; j++)
			scanf("%d", &a[i][j]);
	for(int i = 0; i < n; i++)
		create(1, {i});
	sort(tot.begin(), tot.end(), greater<int>());
	printf("%d\n", tot[c-1]);
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
