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 <bits/stdc++.h>
// existen dos escenarios en el que la media sea maxima o en que sea minima
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<ll,ll> ii;
typedef pair<ll,ii> iii;
const int MAX_N=1510;
bool vis[MAX_N];
vector<vi> ti;
vector<vi> mat;
vector<ii> vma;
int n,m;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
n=x.size(); m=x[0].size();
mat=x;
ti.resize(n);
for(int i=0;i<n;i++){
for(int j=0;j<m;j++) ti[i].push_back(-1);
}
vector<ii> su;
for(int i=0;i<n;i++){
su.push_back(ii(-(x[i][0]+x[i][m-1]),i));
}
sort(su.begin(),su.end());
ll ans=0;
for(int i=0;i<n;i++){
if(i<n/2){
ti[su[i].second][m-1]=0;
ans+=x[su[i].second][m-1];
}
else {
ti[su[i].second][0]=0;
ans-=x[su[i].second][0];
}
}
allocate_tickets(ti);
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... |