Submission #150726

# Submission time Handle Problem Language Result Execution time Memory
150726 2019-09-01T08:52:06 Z 오리버스부릉부릉(#3679, rdd6584, orihehe, phpark) Organizing the Best Squad (FXCUP4_squad) C++17
19 / 100
210 ms 17724 KB
#include "squad.h"
#include <algorithm>
#include <functional>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<ll, int> pli;

vector<pli> k;
vector<int> aa, bb, cc;
int n;

void Init(std::vector<int> a, std::vector<int> b, std::vector<int> c){
	n = a.size();
	aa = a; bb = b; cc = c;
}

long long BestSquad(int x, int y){
	ll mav = 0;
	for (int i = 0; i < n; i++)
		k.push_back({ (ll)x * bb[i] + (ll)y * cc[i], i });
	
	sort(all(k), greater<pli>());
	for (int i = 0; i < n; i++) {
		if (i != k[0].second) {
			mav = max(mav, k[0].first + aa[i] * (ll)x + cc[i] * (ll)y);
		}
		else {
			mav = max(mav, k[1].first + aa[i] * (ll)x + cc[i] * (ll)y);
		}
	}

	return mav;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 210 ms 17552 KB Output is correct
4 Correct 209 ms 17720 KB Output is correct
5 Correct 19 ms 1664 KB Output is correct
6 Correct 208 ms 17720 KB Output is correct
7 Correct 194 ms 17720 KB Output is correct
8 Correct 201 ms 17724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 210 ms 17552 KB Output is correct
4 Correct 209 ms 17720 KB Output is correct
5 Correct 19 ms 1664 KB Output is correct
6 Correct 208 ms 17720 KB Output is correct
7 Correct 194 ms 17720 KB Output is correct
8 Correct 201 ms 17724 KB Output is correct
9 Incorrect 6 ms 384 KB Output isn't correct
10 Halted 0 ms 0 KB -