#include "tickets.h"
#include <vector>
#include <bits/stdc++.h>
#define f first
#define s second
typedef long long ll;
using namespace std;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
int m = x[0].size();
vector<array<int,2>> p(n, {0, m-1});
vector<vector<int>> ans(n, vector<int>(m, -1));
ll total=0;
for(int i=0;i<k;i++){
vector<pair<ll,int>> ch(n);
for(int j=0;j<n;j++){
total+=x[j][p[j][1]];
ch[j].f=x[j][p[j][1]]+x[j][p[j][0]];
ch[j].s=j;
}
sort(ch.begin(),ch.end());
for(int j=0;j<n/2;j++){
total-=ch[j].f;
ans[ch[j].s][p[ch[j].s][0]++]=i;
}
for(int j=n/2;j<n;j++){
ans[ch[j].s][p[ch[j].s][1]--]=i;
}
}
allocate_tickets(ans);
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... |