이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define forint(i, N) for (int i = 0; i < (N); i++)
using namespace std;
void allocate_tickets(vector< vector<int> > s);
int find_maximum(int k, vector< vector<int> > x) {
int n = x.size();
int m = x[0].size();
vector< vector<int> > s(n, vector<int>(m, -1));
vector<int> min_index(n, 0);
vector<int> max_index(n, m-1);
vector<pair<int, int>> increase(n);
int total = 0;
forint(i, k) {
forint(j, n) {
increase[j].first = x[j][min_index[j]] + x[j][max_index[j]];
increase[j].second = j;
}
nth_element(increase.begin(), increase.begin() + n/2, increase.end());
for (int j = 0; j < n/2; j++) {
total -= x[increase[j].second][min_index[increase[j].second]];
s[increase[j].second][min_index[increase[j].second]] = i;
min_index[increase[j].second]++;
}
for (int j = n/2; j < n; j++) {
total += x[increase[j].second][max_index[increase[j].second]];
s[increase[j].second][max_index[increase[j].second]] = i;
max_index[increase[j].second]--;
}
}
allocate_tickets(s);
return total;
}
# | 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... |