이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
long long find_maximum(int k, std::vector<std::vector<int>> x)
{
int N = x.size();
int M = x[0].size();
ll value = 0;
vvi ans(N, vi(M, -1));
vpii choose;
for (int i = 0; i < N; ++i)
{
int mini = min_element(all(x[i])) - x[i].begin();
ans[i][mini] = 0;
mini = x[i][mini];
int maxi = *max_element(all(x[i]));
value -= mini;
choose.push_back({mini + maxi, i});
}
sort(all(choose));
for (int j = sz(choose) - 1; j >= sz(choose) / 2; --j)
{
int i = choose[j].second;
value += choose[j].first;
ans[i][min_element(all(x[i])) - x[i].begin()] = -1;
ans[i][max_element(all(x[i])) - x[i].begin()] = 0;
}
allocate_tickets(ans);
return value;
}
# | 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... |