Submission #150726

#TimeUsernameProblemLanguageResultExecution timeMemory
150726오리버스부릉부릉 (#200)최적의 팀 구성 (FXCUP4_squad)C++17
19 / 100
210 ms17724 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...