# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
300302 | ecnerwala | Carnival Tickets (IOI20_tickets) | C++17 | 1100 ms | 106360 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 "tickets.h"
#include <bits/stdc++.h>
long long find_maximum(int K, std::vector<std::vector<int>> X) {
int N = int(X.size());
int M = int(X[0].size());
std::vector<std::vector<int>> answer(N, std::vector<int>(M, -1));
struct cnd_t {
std::pair<int, int> val;
int i;
int j0, j1;
};
std::vector<cnd_t> cnds; cnds.reserve(N*K);
int64_t tot_val = 0;
{
std::vector<std::pair<int, int>> vals(M);
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
vals[j] = {X[i][j], j};
}
std::sort(vals.begin(), vals.end(), [&](const auto& a, const auto& b) { return a.first < b.first; });
for (int j = 0; j < K; j++) {
tot_val -= vals[j].first;
answer[i][vals[j].second] = -3;
cnds.push_back({{vals[j].first + vals[j+(M-K)].first, j}, i, vals[j].second, vals[j+(M-K)].second});
}
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |