Submission #150013

#TimeUsernameProblemLanguageResultExecution timeMemory
150013From The Sky (#200)Organizing the Best Squad (FXCUP4_squad)C++17
19 / 100
3101 ms25864 KiB
#include "squad.h"
#include <vector>
#include <algorithm>
using namespace std;

int N;
vector<int> A;
vector<int> D;
vector<int> P;

void Init(std::vector<int> AA, std::vector<int> DD, std::vector<int> PP){
	N = AA.size();
	A = AA;
	D = DD;
	P = PP;
	return;
}

long long BestSquad(int X, int Y){
	vector<pair<long long, int>> x;
	vector<pair<long long, int>> y;
	for(int i=0; i<N; i++){
		x.push_back({-1LL*A[i]*X-1LL*P[i]*Y, i});
		y.push_back({-1LL*D[i]*X-1LL*P[i]*Y, i});
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	long long res = 0;
	for(int i=0; i<2; i++){
		for(int j=0; j<2; j++){
			if(x[i].second == y[j].second) continue;
			res = max(res, -x[i].first-y[j].first);
		}
	}
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...