Submission #530115

# Submission time Handle Problem Language Result Execution time Memory
530115 2022-02-24T15:59:58 Z fatemetmhr Olympiads (BOI19_olympiads) C++17
13 / 100
8 ms 1488 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb     push_back
#define fi     first
#define se     second
#define all(x) x.begin(), x.end()

const int maxn5 = 7e3 + 10;

int a[maxn5][2];
vector <ll> av;


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

	int n, k, c; cin >> n >> k >> c;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < k; j++)
			cin >> a[i][j];
	}
	
	if(k == 1){
		for(int i = 0; i < n; i++)
			av.pb(a[i][0]);
		sort(all(av));
		reverse(all(av));
		cout << av[c - 1] << endl;
		return 0;
	}
	
	for(int i = 0; i < n; i++) for(int j = i + 1; j < n; j++){
		av.pb(max(a[i][0], a[j][0]) + max(a[i][1], a[j][1]));
	}
	sort(all(av));
	reverse(all(av));
	cout << av[c - 1] << endl;
}
















# Verdict Execution time Memory Grader output
1 Correct 8 ms 1488 KB Output is correct
2 Correct 7 ms 1488 KB Output is correct
3 Correct 5 ms 1488 KB Output is correct
4 Correct 3 ms 1476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1488 KB Output is correct
2 Correct 7 ms 1488 KB Output is correct
3 Correct 5 ms 1488 KB Output is correct
4 Correct 3 ms 1476 KB Output is correct
5 Incorrect 1 ms 208 KB Output isn't correct
6 Halted 0 ms 0 KB -