답안 #151641

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151641 2019-09-04T02:12:56 Z baikdohyup 최적의 팀 구성 (FXCUP4_squad) C++17
19 / 100
3000 ms 32508 KB
#include "squad.h"
#include <algorithm>
#include <iostream>

std::vector<int> arr1, arr2, arr3;
int N;

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

	arr1 = A;
	arr2 = D;
	arr3 = P;
}

long long BestSquad(int X, int Y){
	std::vector<std::pair<long long, int>> attack;
	std::vector<std::pair<long long, int>> defense;

	for (int i = 0; i < N; i++) {
		attack.push_back(std::pair<long long, int>((long long)arr1[i] * (long long)X + (long long)arr3[i] * (long long)Y, i));
		defense.push_back(std::pair<long long, int>((long long)arr2[i] * (long long)X + (long long)arr3[i] * (long long)Y, i));
	}

	sort(attack.begin(), attack.end());
	sort(defense.begin(), defense.end());

	if (attack.back().second == defense.back().second) {
		return attack[N - 1].first + defense[N - 2].first > attack[N - 2].first + defense[N - 1].first ? attack[N - 1].first + defense[N - 2].first : attack[N - 2].first + defense[N - 1].first;
	}
	else {
		return attack[N - 1].first + defense[N - 1].first;
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 247 ms 31884 KB Output is correct
4 Correct 246 ms 31836 KB Output is correct
5 Correct 16 ms 2424 KB Output is correct
6 Correct 247 ms 31832 KB Output is correct
7 Correct 245 ms 31792 KB Output is correct
8 Correct 246 ms 31792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 1066 ms 932 KB Output is correct
3 Execution timed out 3045 ms 32508 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 247 ms 31884 KB Output is correct
4 Correct 246 ms 31836 KB Output is correct
5 Correct 16 ms 2424 KB Output is correct
6 Correct 247 ms 31832 KB Output is correct
7 Correct 245 ms 31792 KB Output is correct
8 Correct 246 ms 31792 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 1066 ms 932 KB Output is correct
11 Execution timed out 3045 ms 32508 KB Time limit exceeded
12 Halted 0 ms 0 KB -