#奇安信#第一题 100%第二题 50%X感觉写的很对,为什么错了呢,有无大佬帮忙看看X感谢评论区大佬给出错误原因,已经搞懂了class Solution {public: vector vec; bool check(long long mid) { priority_queue q; for(int i = 0; i for(auto x : vec) { long long t = q.top(); q.pop(); q.push(t - x); } if(q.top() > 0) return false; else return true; } int maxTime(vector& bat) { for(auto x : bat) vec.push_back(x); sort(vec.begin(), vec.end(), greater()); int n = vec.size(); long long l = 0, r = vec[0] * n / 5; while(l { long long mid = (l + r + 1) / 2; if(check(mid)) l = mid; else r = mid - 1; } return l; }};