1
class Solution {
2
public:
3
vector<int> successfulPairs(vector<int> &spells, vector<int> &potions, long long success) {
4
vector<int> res;
5
int n(size(potions));
6
sort(begin(potions), end(potions));
7

8
for (auto &spell : spells) {
9
int start(0), end(n);
10
while (start < end) {
11
int mid = start + (end - start) / 2;
12
((long long)spell * potions[mid] >= success) ? end = mid : start = mid + 1;
13
}
14
res.push_back(n - start);
15
}
16
return res;
17
}
18
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0