#include "tickets.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
void allocate_tickets(vector<vector<int>> _d) ;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
int m = x[0].size();
vector<std::vector<int>> answ(n , vector<int> (m , -1));
vector<pair<int , int>> ps(n , {0 , m - 1});
long long ans = 0;
for(int i = 0;i < k; ++ i){
vector<pair<int , int>> vc;
for(int j = 0;j < n; ++ j){
vc.push_back({x[j][ps[j].fi] + x[j][ps[j].se] , j});
}
sort(vc.rbegin() , vc.rend());
for(int j = 0;j < n / 2; ++ j){
int p = vc[j].se;
ans += x[p][ps[p].se];
// cout << x[p][ps[p].se] << ' ';
answ[p][ps[p].se] = i;
ps[p].se --;
}
for(int j = n / 2;j < n; ++ j){
int p = vc[j].se;
ans -= x[p][ps[p].fi];
// cout << x[p][ps[p].fi] << ' ';
answ[p][ps[p].fi] = i;
ps[p].fi ++;
}
// cout << '\n';
}
allocate_tickets(answ);
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... |