#include <iostream>
#include "tickets.h"
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
int n,m;
vector<vector<int>> s,y;
int l[2000];
int r[2000];
int now[2000];
int up[2000];
ll tot;
bool cmp(int n1, int n2){
return y[n1][l[n1]] + y[n1][r[n1]] < y[n2][l[n2]] + y[n2][r[n2]];
}
ll find_maximum(int k, vector<vector<int>> x){
n = x.size();
m = x[0].size();
tot=0;
y = x;
s = x;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
s[i][j]=-1;
}
}
for(int i=0; i<n; i++){
l[i]=0;
r[i]=m-1;
}
for(int ro=0; ro<k; ro++){
for(int i=0; i<n; i++){
up[i]=0;
}
for(int i=0; i<n; i++){
now[i]=i;
}
sort(now, now+n, cmp);
for(int i=n/2; i<n; i++){
tot += y[now[i]][r[now[i]]];
s[now[i]][r[now[i]]]=ro;
r[now[i]]--;
}
for(int i=0; i<n/2; i++){
tot -= y[now[i]][l[now[i]]];
s[now[i]][l[now[i]]]=ro;
l[now[i]]++;
}
}
allocate_tickets(s);
return tot;
}
# | 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... |