Submission #862483

# Submission time Handle Problem Language Result Execution time Memory
862483 2023-10-18T10:29:14 Z maks007 Olympiads (BOI19_olympiads) C++14
0 / 100
2000 ms 348 KB
#include "bits/stdc++.h"
 
using namespace std;

signed main () {
	int n, m, k;
	cin >> n >> m >> k;
	vector <vector <int>> a(n, vector <int> (m));
	vector <int> v, pos(m,0);
	function <void(int,int)> f=[&](int last, int cnt) {
		if(cnt == k) {
			v.push_back(accumulate(pos.begin(), pos.end(), 0));
			return;
		}
		vector <int> prev=pos;
		for(int i = last; i < n; i ++) {
			for(int j = 0; j < m; j ++) {
				pos[j] = max(pos[j], a[i][j]);
			}
				f(i+1, cnt + 1);
				pos = prev;
		}
	};
	for(int i = 0; i < n; i ++) {
		for(int j = 0; j < m; j ++) {
			cin >> a[i][j];
		}
	}
	f(0, 0);
	sort(v.rbegin(), v.rend());
	// for(auto i : v) cout << i << " ";
	cout << v[k-1];
	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2019 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2059 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2019 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -