# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1248056 | bncodero_o123 | Olympiads (BOI19_olympiads) | C++20 | 7 ms | 960 KiB |
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define name "code"
using namespace std;
int n, k, c;
int a[502][8];
namespace SUB1 {
int get(int i, int j) {
int ans= 0;
for(int id= 1; id <= k; ++id)
ans += max(a[i][id], a[j][id]);
return ans;
}
void solve() {
vector<int> all;
for(int i= 1; i <= n; ++i)
for(int j= i + 1; j <= n; ++j)
all.push_back(get(i, j));
sort(all.begin(), all.end());
cout << all[c - 1] << '\n';
}
}
void solve() {
cin >> n >> k >> c;
for(int i= 1; i <= n; ++i)
for(int j= 1; j <= k; ++j)
cin >> a[i][j];
if(k <= 2) SUB1::solve();
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
if(fopen(name".inp", "r")) {
freopen(name".inp", "r", stdin);
freopen(name".out", "w", stdout);
}
int T= 1;
for(; T; --T) solve();
return 0;
}
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... |