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 <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define PB push_back
using ll = long long;
long long find_maximum(int k, vector<vector<int>> x) {
/* sample interaction
int n = x.size();
int m = x[0].size();
vector<vector<int>> answer;
for (int i = 0; i < n; i++) {
vector<int> row(m);
for (int j = 0; j < m; j++) {
if (j < k) {
row[j] = j;
} else {
row[j] = -1;
}
}
answer.push_back(row);
}
allocate_tickets(answer);
return 1;
*/
int n = x.size();
int m = x[0].size();
vector<vector<int>> answer(n, vector<int>(m, -1));
if(m == 1) {
// subtask 1 (only a single way to pick everything)
vector<int> A;
for(int i = 0; i < n; i++) {
A.PB(x[i][0]);
answer[i][0] = 0;
}
sort(A.begin(), A.end());
ll sum = 0;
for(int a : A) {
sum += abs(a-A[n/2]);
}
allocate_tickets(answer);
return sum;
}
else if(k == 1) {
// subtask 2
}
allocate_tickets(answer);
return -1;
}
# | 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... |