이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
long long N,M;
vector< tuple<long long,long long,long long,long long> > lst;
vector< pair<long long,long long> > tmp;
long long find_maximum(int k, vector<vector<int>> x) {
N = x.size(), M = x[0].size();
long long ans = 0;
vector< vector<int> > res(N, vector<int>(M,-1));
for (long long i = 0; i < N; ++i) {
tmp.clear();
for (long long j = 0; j < M; ++j) tmp.emplace_back(x[i][j],j);
sort(tmp.begin(),tmp.end());
ans += tmp.back().first;
res[i][tmp.back().second] = 0;
lst.emplace_back(tmp.back().first+tmp.front().first,i,tmp.front().second,tmp.back().second);
}
sort(lst.begin(),lst.end());
for (long long i = 0; i < N/2; ++i) {
long long a,b,c,d; tie(a,b,c,d) = lst[i];
ans -= a, res[b][d] = -1, res[b][c] = 0;
}
allocate_tickets(res);
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... |