이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<long long, long long>
#define plll pair<long long, pll>
#define ff first
#define ss second
#define ee ss.ff
#define rr ss.ss
using namespace std;
long long find_maximum(int k, vector<vector<int>> x)
{
int n = x.size();
int m = x[0].size();
vector<vector<int>> ret(n, vector<int>(m, -1));
int X[n], Y[n]; long long ans = 0;
for(int i = 0; i < n; ++i) X[i] = min_element(x[i].begin(), x[i].end()) - x[i].begin(), Y[i] = max_element(x[i].begin(), x[i].end()) - x[i].begin(), ans += x[i][Y[i]];
vector<pii> tmp; for(int i = 0; i < n; ++i) tmp.push_back({x[i][X[i]] + x[i][Y[i]], i});
sort(tmp.begin(), tmp.end());
for(int i = 0; i < n / 2; ++i) ans -= tmp[i].ff, ret[tmp[i].ss][X[i]] = 0;
for(int i = n / 2; i < n; ++i) ret[tmp[i].ss][Y[i]] = 0;
allocate_tickets(ret);
return ans;
}
# | 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... |