Ceil + binary search
\ttypedef long long ll;\n\tclass Solution {\n\tpublic:\n\t\tvector successfulPairs(vector& spells, vector& portions, long long success) {\n\t\t\tsort(begin(port
\ttypedef long long ll;\n\tclass Solution {\n\tpublic:\n\t\tvector<int> successfulPairs(vector<int>& spells, vector<int>& portions, long long success) {\n\t\t\tsort(begin(portions),end(portions));\n\t\t\tvector<int>res;\n\t\t\tint m = portions.size();\n\t\t\tfor(auto num:spells){\n\t\t\t\tif(success/num>=100001){\n\t\t\t\t\tres.push_back(0);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tint n = success/num + (success%num!=0);\n\t\t\t\tint i = lower_bound(begin(portions),end(portions),n)-begin(p);\n\t\t\t\tres.push_back(m-i);\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\t};
[]