Submission #1248057

#TimeUsernameProblemLanguageResultExecution timeMemory
1248057bncodero_o123Olympiads (BOI19_olympiads)C++20
13 / 100
7 ms968 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.rbegin(), all.rend());
        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)

olympiads.cpp: In function 'int main()':
olympiads.cpp:43:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |         freopen(name".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
olympiads.cpp:44:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |         freopen(name".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...