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<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
ll oink(vvi x) {
//cerr << endl;
int n = x.size();
vvi Ans(n, {0});
allocate_tickets(Ans);
ll t = 0;
vi L (n);
for (int i = 0; i < n; i++) L[i] = x[i][0];
sort(L.begin(), L.end());
int a = L[n/2];
//cerr << a << endl;
for (auto i : L) t += abs(a-i);
//cerr << endl;
return t;
}
long long find_maximum(int k, vvi x) {
int n = x.size();
int m = x[0].size();
if (m == 1) return oink(x);
vvi answer;
for (int i = 0; i < n; i++) {
vi 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;
}
# | 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... |